![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
It seems my code isn't removing the partition from the measure group. It logs it as being successful, however the partition still remains. Any ideas? Thanks. Dim oPartition As Partition oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e) objMeasureGroup.Partitions.Remove(oPartition) objMeasureGroup.Update() |
#3
| |||
| |||
|
|
In order to remove a major object (Partition included; other major object examples: Dimension, DataSource, Cube, MiningStructure, MiningModel), you need to call .Drop() method on that object. oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e); oPartition.Drop(); The .Drop method removes the object from the AMO structures and also from the server. The .Remove method only removes the object from the AMO collection, but not from the server (like in the code objMeasureGroup.Partitions.Remove(oPartition)). The .Update() method saves the properties and minor collections of an object (but does nothing for its major children), so in the code below, the objMeasureGroup.Update() would not propagate the Partition removal from AMO's structures to the server. There is an overload for the .Update method (with ExpandFull option) that fully saves an object to the server (so you can delete a major object with .Remove and then a full Update on it parent, but this will be way too costly compared to the .Drop method). Adrian. "Jesse O." <jesperzz (AT) hotmail (DOT) com> wrote in message news:uk04Q9bXGHA.4144 (AT) TK2MSFTNGP04 (DOT) phx.gbl... It seems my code isn't removing the partition from the measure group. It logs it as being successful, however the partition still remains. Any ideas? Thanks. Dim oPartition As Partition oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e) objMeasureGroup.Partitions.Remove(oPartition) objMeasureGroup.Update() |
![]() |
| Thread Tools | |
| Display Modes | |
| |