dbTalk Databases Forums  

Creating permanent Calculated member, programmatically

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


Discuss Creating permanent Calculated member, programmatically in the microsoft.public.sqlserver.olap forum.



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

Default Creating permanent Calculated member, programmatically - 08-19-2003 , 05:30 AM







Hi,



Does anyone know how do I make calculated members in a Cube,
programmatically. I understand that the scope of the calculated member
is only limited to the Session for which it is created.

How do I make these newly created members persistent in the Cube? (I do
not want to use MS Analysis Manager for this).



Any pointers, tips would help.

thanks,

Anand


--
Posted via http://dbforums.com

Reply With Quote
  #2  
Old   
Mosha Pasumansky [MS]
 
Posts: n/a

Default Re: Creating permanent Calculated member, programmatically - 08-19-2003 , 05:17 PM






Lutz, you are right, there are few places where Analysis Services
implmentation is different from OLEDB for OLAP spec.
Requiring single quotes around expressions is such a place.

We will look into fixing it in the next version.

--
==================================================
Mosha Pasumansky - www.mosha.com/msolap
Development Lead in the Analysis Server team
All you need is love (John Lennon)
Disclaimer : This posting is provided "AS IS" with no warranties, and
confers no rights.
==================================================
"Lutz Morrien" <nospam.lutz.morrien (AT) ocb (DOT) com> wrote

Quote:
If you search through the SQL Server 2000 online
documentation for the "Create cube"- statement, you can
find the following

"Use the following code to create a calculated member.
You must use single quotes to enclose the expression for
the calculated member. The OLE DB specification, however,
does not require these quotes.

CREATE CUBE MYWAREHOUSE (
DIMENSION . . .
. . . ,
COMMAND (CREATE MEMBER [MYWAREHOUSE].[MEASURES].
[WAREHOUSEPROFIT]
AS '[MEASURES].[WAREHOUSE SALES] - [MEASURES].[WAREHOUSE
COST]')
)"

Maybe that helps.

Lutz




Reply With Quote
  #3  
Old   
anand_h
 
Posts: n/a

Default Re: Creating permanent Calculated member, programmatically - 08-19-2003 , 10:37 PM




Lutz,



I am aware of CREATE MEMBER syntax, but my question was how do I make
these newly created members permanent in the cube? Members created with
CREATE MEMBER are not persistent in the cube - they vanish the moment
the client terminates the session. I wanted to make persistent members
in the cube.

I hope you get the problem?



thanks much,

Anand



Originally posted by Lutz Morrien

Quote:
If you search through the SQL Server 2000 online

documentation for the "Create cube"- statement, you can

find the following



"Use the following code to create a calculated member.

You must use single quotes to enclose the expression for

the calculated member. The OLE DB specification, however,

does not require these quotes.



CREATE CUBE MYWAREHOUSE (

DIMENSION . . .

. . . ,

COMMAND (CREATE MEMBER [MYWAREHOUSE].[MEASURES].

[WAREHOUSEPROFIT]

AS '[MEASURES].[WAREHOUSE SALES] - [MEASURES].[WAREHOUSE

COST]')

)"



Maybe that helps.


Lutz


--
Posted via http://dbforums.com


Reply With Quote
  #4  
Old   
asim73
 
Posts: n/a

Default Re: Creating permanent Calculated member, programmatically - 08-21-2003 , 12:57 AM




You can use ALTER CUBE........



For complete syntax you can search it in books online of analysis
manager.



Here is a cut/paste from that books online



Note that its not only CREATE MEMBER its ALTER CUBE CREATE MEMBER.





This example shows how to create a new dimension member. To add a
member, specify its parent member in the CREATE DIMENSION MEMBER
statement, and specify a key that uniquely identifies the member.



The following code adds Idaho and Boise to the Geography dimension:



ALTER_CUBE = ALTER CUBE Sales CREATE DIMENSION MEMBER USA.IDAHO, KEY =
STATE_IDAHO, CREATE DIMENSION MEMBER IDAHO.BOISE, KEY=CITY_BOISE





Please let me know if this worked or not.





Thanks



Asim Naveed.


--
Posted via http://dbforums.com

Reply With Quote
  #5  
Old   
anand_h
 
Posts: n/a

Default Re: Creating permanent Calculated member, programmatically - 08-21-2003 , 08:40 AM




Asim,



I guess this is adding a new dimension member to the cube.

What I want to do is define a "Calculated" Measure say "SalesByTwo"
which is to be defined as ([Measures].[Unit Sales]/2).



How do I do that with ALTER CUBE? I don't think it is doing that..

Do you agree?



Anand









Originally posted by asim73

Quote:
You can use ALTER CUBE........



For complete syntax you can search it in books online of analysis
manager.



Here is a cut/paste from that books online



Note that its not only CREATE MEMBER its ALTER CUBE CREATE MEMBER.





This example shows how to create a new dimension member. To add a
member, specify its parent member in the CREATE DIMENSION MEMBER
statement, and specify a key that uniquely identifies the member.



The following code adds Idaho and Boise to the Geography dimension:



ALTER_CUBE = ALTER CUBE Sales CREATE DIMENSION MEMBER USA.IDAHO, KEY =
STATE_IDAHO, CREATE DIMENSION MEMBER IDAHO.BOISE, KEY=CITY_BOISE





Please let me know if this worked or not.





Thanks


Asim Naveed.


--
Posted via http://dbforums.com


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.