Need help on the .net code to update M Expression in Tabular Model.

Copper Contributor

Hi All,

 

Kindly help on the code for updating the M expression code with .net for SSAS Tabular model.

 

Scenario:

we have table with partition and we have to update the partition query using .net

 

we have code to replace the existing M Expression with New one ,unfortunately the changes are not updating in Database LEVEL .(SSAS Tabular) .May be i missed any syntax of the .net code.

 

Please see below code and help out in this.

 

TOA.Partition partition = m.Tables.Find(Table).Partitions[1];

 

OverrideCollection oc = new OverrideCollection
{

Partitions =
{
new PartitionOverride
{

OriginalObject =partition,

Source = new MPartitionSourceOverride
{
Expression=expressions

}


}


}

};



var listOc = new List<OverrideCollection>();
listOc.Add(oc);
partition.RequestRefresh(TOA.RefreshType.Add, listOc);

// m.Tables[Table].Partitions[1].Refresh(TOA.RefreshType.Full, listOc); //it is not working 
db.Update(UpdateOptions.ExpandFull);

db.Model.SaveChanges();
m.SaveChanges();

TOA.Partition partition1 = m.Tables.Find(Table).Partitions[1];

 

0 Replies