SSAS: AMO gems from the MSDN Forum - Measures.Remove()

The second gem from the Analysis Services MSDN forum is also by Adrian Dumitrascu and deals with what the second "CleanUp" argument of the Measures.Remove() method does.

MeasuresCollection.Remove() Method

The 'cleanUp' boolean argument specifies if the dependent objects will be removed. For a Measure, the dependents include the PerspectiveMeasure objects. For a DimensionAttribute, the dependents include the CubeAttribute objects.

If you do not specify the 'cleanUp' parameter, the dependents are removed.

If you want for example to replace one object with another (having the same ID), then you can use the 'cleanUp'=false argument.

When working connected to the server, the 'cleanUp' argument has limited use, because you cannot save an invalid object or an object that would invalidate other objects in the database. For example, if you chose to remove a Measure with 'cleanUp'=false and dependent PerspectiveMeasures do exist, then you will get an error when trying to save the MeasureGroup (because it will leave the Perspective(s) with broken references).

Technorati Tags: ,

Print | posted on Wednesday, July 18, 2007 11:32 PM