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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hugmarcel
Specialist
Specialist

Set table box column names by function

I'd like to add columns of a table to a table box and assigne a label to each column with the help of a function.

E.g. loaded table has qualified columns:

TABLE_NAME.fieldname1

TABLE_NAME.fieldname2

TABLE_NAME.fieldname3

As column labels, 'fieldname1', 'fieldname2', 'fieldname3' shall be used in the table box. How can these labels be given with the help of a labeling function?

e.g. = fieldname(0,'TABLE_NAME') does not work for fieldname1, as fieldname() is a script function only.

Thx - Marcel

3 Replies
Miguel_Angel_Baeyens

Hi Marcel,

It seems you are using QUALIFY in your script. If you want to keep using it, just rename it to FieldName1 manually. If all fields are named like that, you can use the function

=SubField('TABLE_NAME.fieldname1', '.', 2)

but I don't see the advantage of using this instead of typing the name for each field. There are no "labelling functions" but string functions.

Is that what you are looking for?

Miguel

hugmarcel
Specialist
Specialist
Author

I'd like to use the function-method because column names will be automatically adjusted in the table box when I rename the column name in the script. This would be especially helpful when I re-use the same column in several table boxes.

Of course a string function would be needed for that, containing the current field reference as a parameter. But "current table field" does not exist as a function in the table box dialog.

Miguel_Angel_Baeyens

Hi Marcel,


There is no such function to know what fields are you using in a table box. But you can create a table with the field names, although the main problem remains: you still have to manually rename them either in the script or in the object.

Hope that makes sense.

Miguel