Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to remove/add columns, programmatically, in a table. When using the API Explorer I can get a list of all kolumns and measures using GetLayout but my question is this: using an API, which method is appropriate for adding/removing columns in a table?
Best
Anders
Using the .NetSDK you could do something like this in C#:
ITable table = app.GetObject<Table>(<the id of the table object>);
using (table.SuspendedLayout)
{
table.Properties.HyperCubeDef.Dimensions = table.Properties.HyperCubeDef.Dimensions.Where(KeepColumn);
}
And then "KeepColumn" would be a function that looks something like this:
private static bool KeepColumn(TableHyperCubeDimensionDef dimensionDef)
{
return <logic to check that I want to keep dimension>;
}