I have the following Mdx code

Scope (
        {[Dim PNL].[PNL].&[88]}
,[Measures].members


);       
this = iif( aggregate([Dim PNL].[PNL].&[12],[Measures].currentmember)<>0, 
aggregate([Dim PNL].[PNL].&[60],[Measures].currentmember)
/(-1* aggregate([Dim PNL].[PNL].&[12],[Measures].currentmember)),null
);       
End Scope;  

I'm trying to reate it using a MDX ADOMD command from C# code.Any suggestions ?

有帮助吗?

解决方案

You cannot change the cube structure via ADOMD, but you can using AMO. However, you will have to do all the parsing of the calculation script yourself, as all you can access is one large string containing the complete calculation script.

Assuming you have an AMO Cube object named cube, you can access the calculation script for reading and writing via

cube.DefaultMdxScript.Commands[0].Text

After doing your changes, you should call

cube.Update()

to write the changes back to the running cube.

As you see, technically there can be several calculation scripts in a cube. But BIDS combines all of them to one on reading (at least I think it does), and on writing, BIDS writes everything to the first script again.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top