Hi
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
' Remove if found
If dsoCube.Commands.Find("CommandName") Then
dsoCube.Commands.Remove ("CommandName")
End If
Set dsoCommand = dsoCube.Commands.AddNew("CommandName")
dsoCommand.CommandType = DSO.CommandTypes.cmdCreateCellCalculation
dsoCommand.Description = "CommandDescription"
dsoCommand.Statement = "CREATE CELL CALCULATION [Test].[x] FOR
'{[Account].&[5102]}' 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.
thanksSOLVED
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.
No comments:
Post a Comment