Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
WEBINAR April 23, 2025: Iceberg Ahead: The Future of Open Lakehouses - REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
nezuko_kamado
Creator
Creator

Getfieldselections() sort order inconsistency

I have a question regarding of Getfieldselections() orders. I used the script below at loadeditor to choose ‘savedMonth1’ in order.

set vSelectedMonth1 = Subfield(Getfieldselections(savedMonth1),',',1);

set vSelectedMonth2 = Trim(Subfield(Getfieldselections(savedMonth1),',',2));

set vSelectedMonth3 = Trim(Subfield(Getfieldselections(savedMonth1),',',3));

set vSelectedMonth4 = Trim(Subfield(Getfieldselections(savedMonth1),',',4));

set vSelectedMonth5 = Trim(Subfield(Getfieldselections(savedMonth1),',',5));

Which works perfectly fine for the first five months of data set (Sep 22>Oct22 > Nov22 > Dec22> Jan23 )

nezuko_kamado_0-1689003662402.png

 

Then I select the recent five months of  Dec 22> Jan 23> Feb23 > Mar23 > Apr23 , the order of months gets messed up.

It shows as Feb 23> Jan23 > Dec22 > Mar 23> Apr23.

nezuko_kamado_1-1689003996727.png

When I try Nov22>Dec 22> Jan 23> Feb23 > Mar23 , it displays Dec22>Nov22>Jan23>Feb23>Mar23 as well.

 Do you know why is this happening?

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

AFAIK you couldn't influence the sort-ordering of values within the getfieldselections() unless you used numerical values. Means instead of Dec 22 you applies 202212 respectively dual('Dec 22', 202212).

Beside this you may consider a simplifying of the logic like:

count(
  {< StringMonth1 = {"$=(subfield(concat(distinct StringMonth1, ',', NumericalMonth1), ',', 1))"}>}
Event)

View solution in original post

1 Reply
marcus_sommer

AFAIK you couldn't influence the sort-ordering of values within the getfieldselections() unless you used numerical values. Means instead of Dec 22 you applies 202212 respectively dual('Dec 22', 202212).

Beside this you may consider a simplifying of the logic like:

count(
  {< StringMonth1 = {"$=(subfield(concat(distinct StringMonth1, ',', NumericalMonth1), ',', 1))"}>}
Event)