Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
subin6600
Creator III
Creator III

Macro for setting load order for Fields Displayed in Table Box

Hi QlikViewer's,

I have a table box which is populated by a macro using the field selections a user wants. But the order of the fields displayed would be in the alphabetical order. i.e., I have two 4 fields.

NameAgeRegionMobile

Subin

25India9900
George26USA8899
Thomas28China7898

So, a user selects, Name & Age as the fields to be displayed - first selection on Name & then on Age

then both the fields would be displayed as below,

AgeName
25Subin
26George
28Thomas

As you see the above order, the fields are displayed in Alphabetical order. How can we achieve to get the load order. i.e., First Name field should be shown and then Age Field.

Regards,

Subin

5 Replies
marcus_sommer

If you want build the tablebox with a user-defined field-order you will need to store the selected values into a variable, something like:

varFieldOrder = '$(varFieldOrder)' & getfieldselections(YourFieldListbox, '|') & '|' &

then you could loop through these variable. But you will need some more logic to clear the variable after creating the tablebox and handle any errors. Easier could be to create such field-order by the tablebox in steps - first step: tablebox wille be created with the first field, second/third ... step will be to append field after field.

THe easiest way would be the user adjust the tablebox by drag 'n drop ...

- Marcus

subin6600
Creator III
Creator III
Author

Hi Marcus, I got your idea of storing the user selected fields in a variable. But how can I loop it to be visible to the users in a table box?

marcus_sommer

You could use inside the vbs the split() function with the delimiter "|" to create an array through which you could loop.

- Marcus

subin6600
Creator III
Creator III
Author

Hi Marcus, When tried to get the getFieldSelections with the field, the values gets sorted again in alphabetical order.

marcus_sommer

It was meant for a step by step selection and each single selection will be concatenated to the variable-value. Will be several field-values selected at once then there won't be any possibilty to track a order - it will be ordered alphabetically.

- Marcus