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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change column lable of a tablebox in macro?

Hi,

I want to change the properties of TableBox through macros. For example change the label of a column, Set "Omit Rows where Field is NULL" as checked for a field in presentation tab.

I was looking to in API Guide and I found following example under TableBox - SetProperties.

set tb = ActiveDocument.Sheets("Main").CreateTableBox

tb.AddField "Class"

tb.AddField "Member"

set tb = tb.GetProperties

tp.Layout.Frame.Name.v = "MyTable"

tb.SetProperties tp

I understand how to change the name of the table. How do I change other values, like field label, using this approach? Where can I find documentation for more property settings, etc.

Please help.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Sallam,

Here's an example on how to create a tablebox with two fields, rename the labels and check the "Omit rows where field is NULL" for both fields.

sub TB

set mybox = ActiveDocument.ActiveSheet.CreateTableBox
mybox.AddField "Field1"
mybox.AddField "Field2"
set tbp = mybox.GetProperties
set cols = tbp.Layout.ColLayouts
for i = 0 to cols.Count-1
cols.Item(i).Label.v = "Column"&i+1
cols.Item(i).NullSuppression = true
next
mybox.SetProperties tbp
end sub

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi Sallam,

Here's an example on how to create a tablebox with two fields, rename the labels and check the "Omit rows where field is NULL" for both fields.

sub TB

set mybox = ActiveDocument.ActiveSheet.CreateTableBox
mybox.AddField "Field1"
mybox.AddField "Field2"
set tbp = mybox.GetProperties
set cols = tbp.Layout.ColLayouts
for i = 0 to cols.Count-1
cols.Item(i).Label.v = "Column"&i+1
cols.Item(i).NullSuppression = true
next
mybox.SetProperties tbp
end sub

Not applicable
Author

Hi Johannes,

Thanks for the help.

Satheesh