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: 
charlie03
Contributor II
Contributor II

Sorting of GetFieldSelections()

Hi,

I would like to understand how does Qlik Sense sort when displaying the values after applying the GetFieldSelections() function.

For example, I have the following loaded:

table:
load * inline [
	Selection
    Account Age
    Age
    Available Access Technology
    Channel
    Contract Binding
    Current Access Technology
    Flow
    Revenue Category
    ];

The loaded table is sorted alphabetically. When I use the GetFieldSelections(Selection, ', ' , 200) in the front end, I don't understand how it is sorted when displaying the figures.

If I select "Account Age" and "Age", I get the following result, which is alphabetically sorted:

Account Age, Age

However, if I add "Channel", I get the following result:

Channel, Account Age, Age

I would need that it is still sorted when clicking on the values.

Thanks for any help, it's highly appreciated!

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Never really looked how the sorting happens within getfieldselections() and I rather doubt that there are possibilities to adjust the behaviour.

If you really need a string-list of the values you could use: concat(distinct FIELD, ',') to get the values alpha-numerical sorted. Concat() has further the option to add a numerical third parameter which defined the sort-order. Such parameter might be created within the load, for example per recno() or rowno().

If not such list is needed else the result should be used within a set analysis you may better take p() for it.

View solution in original post

2 Replies
marcus_sommer

Never really looked how the sorting happens within getfieldselections() and I rather doubt that there are possibilities to adjust the behaviour.

If you really need a string-list of the values you could use: concat(distinct FIELD, ',') to get the values alpha-numerical sorted. Concat() has further the option to add a numerical third parameter which defined the sort-order. Such parameter might be created within the load, for example per recno() or rowno().

If not such list is needed else the result should be used within a set analysis you may better take p() for it.

charlie03
Contributor II
Contributor II
Author

That worked, thanks!