dbTalk Databases Forums  

Create Cell Calculation Problem

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


Discuss Create Cell Calculation Problem in the microsoft.public.sqlserver.olap forum.



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

Default Create Cell Calculation Problem - 04-24-2006 , 08:47 AM






I am trying to set up a cell calculation using DSO and can not figure
out why it fails. The code is in VB6 (also tried in c#) but to no
avail.

Any help - thanks a lot
---
Dim dsoServer As New DSO.Server
Dim dsodb As Variant
dsoServer.Name = "ServerName"
dsoServer.Connect "ServerName"
Set dsodb = dsoServer.MDStores.Item("DBName") ' Name of AS Database

Dim dsoCube As DSO.Cube
Set dsoCube = dsodb.MDStores.Item("Test") ' Name of Cube

Dim dsoCommand As Variant

If dsoCube.Commands.Find(oRS("CommandName")) Then
dsoCube.Commands.Remove (oRS("CommandName"))
End If

Set dsoCommand = dsoCube.Commands.AddNew(oRS("CommandName"))
dsoCommand.CommandType = DSO.CommandTypes.cmdCreateCellCalculation
dsoCommand.Description = oRS("CommandDescription")
dsoCommand.Statement = "CREATE CELL CALCULATION [Test].[x] FOR
{[Mesures].[Forecast]}' AS '1001'"

dsoCube.Update

dsoServer.CloseServer
---

It creates a cell calulation object and saves it in the cube, but when
I look at it in analysis manager I get 2 errors...

1. Unable to pase the CREATE CELL FORMULA command. Please use DSO to
edit this command. Automation Error.

2. Unable to pase the CREATE CELL CALCULATION command. Please use DSO
to edit this command. Automation Error.

thanks


Reply With Quote
  #2  
Old   
cubes
 
Posts: n/a

Default Re: Create Cell Calculation Problem - 04-24-2006 , 08:59 PM






SOLVED

The Statement needed "( )" around the sets in the FOR part (which would
normally indicate a tuple of the sets - which does not make sense to
me)... so it looks like this...

dsoCommand.Statement = "CREATE CELL CALCULATION CURRENTCUBE.[x] FOR
'({[Account].&[5102]})' AS '1001'"

I also used CURRENTCUBE instead of naming the cube.

No I can put the other 400 calcs in the cube and see how it performs

Hope this saves someone some time.


Reply With Quote
  #3  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Create Cell Calculation Problem - 04-25-2006 , 12:37 AM



Well, it looks like there's a discrepancy between the BOL documentation
for AS 2000 and AS 2005. The AS 2000 BOL actually do call for
parentheses around the list of sets:

http://msdn.microsoft.com/library/de.../en-us/olapdmp
r/pt_prddldml_7tv8.asp
Quote:
formula body> ::= FOR '(<set description clause>)' AS '<formula
clause>'
...
CREATE CELL CALCULATION [Sales].[Mexico Adjustments]
FOR '(Descendants([Mexico], [City], SELF), {[2000]})'
...
Quote:
But the AS 2005 BOL only specify a Set Expression:

http://msdn2.microsoft.com/en-us/library/ms144836.aspx
Quote:
CREATE CELL CALCULATION Cube_Expression.CellCalc_Identifier FOR
Set_Expression
...
Set_Expression
A valid MDX expression that evaluates to a set.
...
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.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.