Saturday, February 25, 2012

AMO: list of cubes using a dim

Hello!

I'm trying to get a list of all cubes which are using a specific dimension with AMO. I could get a list of all cubes, then all dimensions used by each cube and check where my dimension is used but I feel there must be a more elegent solution ;-)
There is a GetReferences method in the Dimension object but I don't know how to use it, any idea or a better way to get my list ?

Other question: is there a way to automatically do a full or update process on each dim of a cube when we process this cube without having to list them all before ?

Thx!

I suggest to write the code that you mentioned: iterate over all Cubes and their CubeDimensions, checking which CubeDimension points to your Dimension. Because one Dimension can be included multiple times in a Cube (role-playing dimensions feature), you won't be able to use the cube.Dimensions.Contain(...) method (because that method is based on the ID of the CubeDimension which is not necessarily the same as the ID of the Dimension). When checking if a CubeDimension points to your Dimension, it's faster to compare the string IDs (CubeDimension.DimensionID with Dimension.ID, case insensitive compare), than to use the CubeDimension.Dimension property (because that does a lookup).

The GetReferences method will do the same iterations over all the Cubes and their CubeDimensions, plus more (so it won't be faster than your code).

Adrian

|||Thx for your help Adrian!

No comments:

Post a Comment