Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort a listbox by specific value

Hello guys,

I am trying to sort the listbox Store (see underneath listbox). the requirement is:

on the highest level:

DP..

WS..

BM..

INT

which expression or setting should i use ?

Thanks for your help!

12 Replies
Anonymous
Not applicable
Author

The easiest way I think is to do a Load Inline of the fields with the values in the order you want them. (For example do an export of the values you have in a listbox.) Then you can set it to Sort by Load order.

tamilarasu
Champion
Champion

Hi Rega,

Use below expression as sort expression in sort tab.

=WildMatch(StoreCode,'DP*','WS*','BM*','INT*')

marcus_sommer

Try a sorting expression like this:

= wildmatch(StoreCode, 'DP*', 'WS*', 'BM*', 'INT*', '*')

- Marcus

Not applicable
Author

Hi Helena,

I am really want to learn how to use Load Inline to sort the order of the fields.

For example, I have a data field called "Case Type" that contains a few type of values "Less Important Case, Other Case, Important Case".

I've created a list box and now the order of these values are "Less Important Case, Other Case, Important Case".

But I want to customize the listing order by showing "Important Case, Less Important case, Other Case". Can you share with me that how can I use the command "Load Inline" to achieve me goal?

Thanks,

Becky

ziadm
Specialist
Specialist

Hi
Assign a sort order to the Store order in the way you want to sort them

and that can be by adding another field in your source data Sortorder

use Dual Function in your load statement

such as Dual(StoreCode,SortOrder)

Anonymous
Not applicable
Author

‌hi Becky,

in the script you can do a Load inline like this:

Load * Inline [

[Case Type]

Important Case

Other Case

Less Important Case

];

list ist them in the order you need them.

Then after your reload, that order is now established, ie the values were loaded in this order you specified them. Then in the list box, on the Sort tab, check that Load order is used. (You may need to uncheck other types of sorting for this to become active.)

i hope this is clear.

best regards,

Helena

susovan
Partner - Specialist
Partner - Specialist

Hi Rega,

Also try this attachment,

Warm Regards,
Susovan
Not applicable
Author

Hi Helena,

Thanks so much for your response. I tried it but shows error. Where do you think was wrong?

Also, I am expecting to load other fields at the same time with the [Case Type] field from the same table, such as "Case ID", "Case Date".

I wasn't sure where should I place other field names?  It will show errors, if I do this:

Load * Inline [

[Case ID],

[Case Date],

[Report Type]
Spontaneous
Report from Study,
Others
];

From ....

Where ...

Do you mind let me know where was wrong?

marcus_sommer

The reason for this error are the square brackets [] which belonged to the inline-statement itself and which now confused the syntax-interpreter. To declare a field within the inline-table is it not necessary to wrap field-names with spaces or special chars with square-brackets  - it is like reading a fieldname from a flat-file.

If you want to use any special chars it's common to use double-quotes to wrap these data-item. Other possibilities are to double these special chars like ]] or to use a mix of various quotes.

- Marcus