Saturday, February 25, 2012

AMO: Looping to delete partitions

Hi

I am trying - in AMO code - to loop over the partitions in my different measure groups and drop these. But apparently I am not allowed to do it with the following code, since I am modifying the collection which I am looping (because I drop the partitions which exist in the collection).

....

For Each oMeasuregroup in oCube.MeasureGroups

For Each oPartition in oMeasureGroup.Partitions

oPartition.Drop()

Next

Next

...

Can anyone help me with a solution? Thanks.

Hi,

You need to iterate over the partitions collection with integer index.

PartitionCollection partitions = ...;

for( int i=partitions.Count-1; i>=0; --i )
partitions[ i ].Drop();

Adrian Dumitrascu

No comments:

Post a Comment