SSAS AMO Object : Script to find a particular partition in a Measure group
In AMO scripting to find a particular Partition in a Measure group then see the below script
//Declare AMO server object and get the server detail from connection manager
amoServer = new AMO.Server();
//Declare AMO server object and get the server detail from connection manager
amoServer = new AMO.Server();
amoServer.Connect(myConnectionManager.ConnectionString);
// Then get Measure group name using FindByName function
amoMeasureGroup = amoServer.Databases.FindByName(amoServer.ConnectionInfo.Catalog.ToString()).Cubes.FindByName(myCubeName).MeasureGroups.FindByName(myMeasureGroupName);
amoServer.CaptureXml = true;
// Prepare partition name which you are going to search
String myNextPartitionName = myPartitionNamePrefix + myLastPeriodName_source.Replace(":", "_").Replace("-", "_");
//check wether next partition already exists
if (!amoMeasureGroup.Partitions.Contains(myNextPartitionName))
Comments
Post a Comment