Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

New Columns in Table Straight Table using macro

Hello Friend,

I want to add one columns in straight table using macro, one by one cell.

Does any one knows?

Thanks

3 Replies
Anonymous
Not applicable
Author

This might not work in Ajax. Do you want to perform a calculation in the macro, or is it just there to decide whether to show or hide columns. You can show or hide columns using the conditional show on the dimensions and expressions, which can test for the value of a variable that can be set using buttons etc. without needing to use a macro.

If you want to do in a macro anyway, then the following code taken from the API Guide should help:

rem create new straight table and switch places of dimension columns

set chart = ActiveDocument.Sheets("Main").CreateStraightTable

chart.AddDimension "ProductType"

chart.AddDimension "ProductGroup"

chart.AddExpression "sum(Amount)"

You will want to access an existing chart instead of creating a chart as they have done on the set chart line.

set chart = ActiveDocument.GetSheetObject("CH01")

Where CH01 is the code on the chart's General properties.

You may also want this to delete columns:

chart.RemoveDimension 1

chart.removeExpression 1

Where the number parameter is the dimension or expression number (i.e. the order in which it is set up in the properties).

Jonathan

Not applicable
Author

Thanks Jonathan for reply.

Actually i want to calculate that column dynamically one by one  cell and then i want to add it into table.

Anonymous
Not applicable
Author

The macro code I posted should help you with adding into a table. The calculations you want to perform were not discussed.

Jonathan