dbTalk Databases Forums  

Adding Custom member using script

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Adding Custom member using script in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeethendar
 
Posts: n/a

Default Adding Custom member using script - 11-09-2004 , 03:28 AM






Does any one know how to add a Calculated member to the Cube using the
DSO objects (using scripts).

Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default RE: Adding Custom member using script - 11-09-2004 , 02:37 PM






This VBScript working snippet should help:

set dsoServer = CreateObject("DSO.Server")
dsoServer.Connect "LocalHost"
Set dsoCube= dsoServer.MDStores("Foodmart 2000").Cubes("Sales")
Set dsoCommand= dsoCube.Commands.AddNew("Test Member")
dsoCommand.CommandType=1
dsoCommand.Statement= "Create Member CURRENTCUBE.Measures.[Test Member] as
'[Measures].[Unit Sales] * 2'"
dsoCube.Update

This is just the basic code, you should add locking, error handling...
HTH,
Brian
www.geocities.com/brianaltmann/olap.html

"Jeethendar" wrote:

Quote:
Does any one know how to add a Calculated member to the Cube using the
DSO objects (using scripts).


Reply With Quote
  #3  
Old   
Dave Wickert [MSFT]
 
Posts: n/a

Default Re: Adding Custom member using script - 11-09-2004 , 05:46 PM



Make sure that you quote the text properly. SSAS uses html encoding for some
properties. One of the ways to figure this out is to 1) write a reverse
version of the script which would display the Command object that was
created by AM, or 2) Use the Metadata Scripter utility on the SQL Server
2000 Resource Kit (available at your local bookstore, http://www.bn.com, or
if you can find someone in your company with a TechNet subscription on the
Resource Kit CD/DVD), or via the DSO/XML utility at:
http://www.microsoft.com/downloads/d...DisplayLang=en

--
Dave Wickert [MSFT]
dwickert (AT) online (DOT) microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Brian Altmann" <findme@thesignaturewebsite> wrote

Quote:
This VBScript working snippet should help:

set dsoServer = CreateObject("DSO.Server")
dsoServer.Connect "LocalHost"
Set dsoCube= dsoServer.MDStores("Foodmart 2000").Cubes("Sales")
Set dsoCommand= dsoCube.Commands.AddNew("Test Member")
dsoCommand.CommandType=1
dsoCommand.Statement= "Create Member CURRENTCUBE.Measures.[Test Member] as
'[Measures].[Unit Sales] * 2'"
dsoCube.Update

This is just the basic code, you should add locking, error handling...
HTH,
Brian
www.geocities.com/brianaltmann/olap.html

"Jeethendar" wrote:

Does any one know how to add a Calculated member to the Cube using the
DSO objects (using scripts).




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.