Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting in list box

Hi all,

I am very new to qlikview and right now I am using the free personal edition to see what this BI tool can do.

For my question, I have a list box with the values:

Apr

Aug

Feb

Dec

Jan

Jul

Jun

Mar

May

Nov

Oct

Sep

1. How can I custom sort this list to Jan, Feb, Mar, and so on?

2. Everytime I choose a value in this listbox, it promotes that value to the top of the list. How can I make it stay in its original position?

Thanks in advace.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

Right now your monthnames are just text values. You can either load them as proper date values by deriving the Month() name from a timestamp, or if you just create the field manually, try sorting them by load order.

For question #2, try disabling the "State" = Auto Ascending sort option under your listbox > Sort properties.

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Hi,

Right now your monthnames are just text values. You can either load them as proper date values by deriving the Month() name from a timestamp, or if you just create the field manually, try sorting them by load order.

For question #2, try disabling the "State" = Auto Ascending sort option under your listbox > Sort properties.

Not applicable
Author

Hi Johannes,

First of all, thank you for replying.

As I said in my first post, I am very new so please bear with me 🙂

1. I unchecked all checkboxes under the SORT and just left LOAD ORDER and it worked, great.

2. Got this one, thanks.

Not applicable
Author

Just a follow up on #1.

What if I want it sort in any other way other than ascending, descending or according to the original data load? Is there anyway I can define this custom sorting?

Anonymous
Not applicable
Author

Not sure how you load the months now, but if you do it as an inline load, you can just add a numeric field for sorting like this:

LOAD * INLINE [

    Month, MonthSort

    Feb, 2

    Jan, 1

    Apr, 4

    Mar, 3

    May, 5

    Jul, 7

    Jun, 6

    Sep, 9

    Aug, 8

    Nov, 11

    Oct, 10

    Dec, 12

];

Now you can sort the field by "Expression" and just put in MonthSort as the sorting expression

Not applicable
Author

Hi Johannes,

The field Month is part of the Excel table I loaded through DATA FROM FILES, TABLE FILES.

I am attaching the code when I click on the EDIT SCRIPT:

Where do I place the code that yuo have suggested?

Thanks