Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Alter layout of table

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

1 Reply
Øystein_Kolsrud
Employee
Employee

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>;

}