Friday, February 24, 2012

AMO: About the measure object''s remove method.

hi,friend, please look this:

I have a measure object in AMO.

Dim meas As Microsoft.AnalysisServices.Measure
Meas =tDatabase.Cubes(0).MeasureGroups(0).Measures(0)

tDatabase.Cubes(0).MeasureGroups(0).Measures.Remove(Meas, True)

I just want to know the meaning of the Remove method's second para. Measures.Remove(item as Microsoft.AnalysisServices.Measure, CleanUp as boolean)

What's the CleanUP? The remove method also support to only use the item para. What happened if I set the CleanUP to True/False, or just missing it?

Thanks!

Hi,

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).

Adrian Dumitrascu

|||

Thank you very much, Adrian.

As you said,The 'cleanUp' boolean argument specifies if the dependent objects will be removed.

I want to konw, the KPI object is the dependent object to the Measure? When I remove a measure with CleanUp= True, will the KPI associated be removed too? Or Just I need to remove the KPI by myself? If I don't remove the KPI, but removed the measure which associated, will it report an error when I save it to the server?

Thanks again.

|||

> I want to konw, the KPI object is the dependent object to the Measure? When I remove a measure with CleanUp= True, will the KPI associated be removed too?

No, the KPI objects are not removed. If the Value property of the KPI is referring to a certain measure, when you delete that measure, AMO will not parse the Value (nor any Command objects from an MdxScript in the Cube, or other MDX fragments in other objects) to see if the measure is used.

When checking for dependents, AMO only sees direct-defined metadata references; for example: a PerspectiveMeasure has the MeasureID property to reference the Measure, a CubeAttribute has the AttributeID property to reference a DimensionAttribute, a CubeDimension has the DimensionID property to reference a Dimension.

> If I don't remove the KPI, but removed the measure which associated, will it report an error when I save it to the server?

The .Update() method will succeed (because the Analysis Services engine will do a similar dependencies analysis as AMO), but you will get MDX errors when browsing.

Adrian Dumitrascu

|||

very clear!

Thank you, Adrian!

No comments:

Post a Comment