Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Match()

Hi All,

I have to sort Expense type field, it contains many number of values.

For example: values are A to Z.

I want to make order sequence like Z,A,L and remaining values are same order.

This one should do only in UI design side ( not by Apply-map).

Please help me on it.

Thanks,

NiHhal.

9 Replies
arulsettu
Master III
Master III

hi

try if(match(Expense,'Z','A','L'),Expense)

hope it helps.....

Not applicable

Can you try this in the UI ?

Express sort order:

match(ExpenseType,'L,' 'A', 'Z')

so that Z will get 3, A will get 2, and L will get 1

the other will not be found and will get 0

Fabrice

arulsettu
Master III
Master III

hi

or in properties SORT tab text Z-A.. try that...

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

To add to AUNEZ FABRICE  this will then leave the rest of the values in a random order, or if you text the Text as well as the Expression sort it should pick up, but I would look at ensuring the expression delivers the right sort order.

The sort expression would then be something like:

=if(match(ExpenseType,'L,' 'A', 'Z') = 0, '9', match(ExpenseType,'L,' 'A', 'Z')) & ExpenseType


This would put a single digit in front of the Expense type for the sort order of 1,2,3 or 9, the rest of the Expense type is then used for the rest of the sort.


It's a shame you can't do anything in the load script, as this would be much more performant and robust.  You could do it by making expense type a dual data type (ie. it has a numeric representation as well as a text one).

jagan
Luminary Alumni
Luminary Alumni

Hi,

If values are more then it is difficult to manage in Match function, instead you can create one Inline/Excel table like this

LOAD

*

INLINE [

Expense type, SortOrder

Z, 1

A, 2

L, 3

];

Now in sort tab just SortOrder. Hope this helps you.

Regards,

Jagan.

SunilChauhan
Champion II
Champion II

Try Below

Chart properties-> short Expression

wildmatch( FieldName,'Z','A','L',Fieldname)

Hope this helps

Sunil Chauhan
IAMDV
Luminary Alumni
Luminary Alumni

Hi Nihhal,

I've made a video tutorial on Match() function. Here is the link to my blog (Copy & Paste):

http://qlikshare.com/292

Hope it helps!

Cheers,

DV

maxgro
MVP
MVP

in sort tab of listbox Expense

- flag expression ascending

- flag text ascending

-in expression use   wildmatch(Expense, 'Z', 'A', 'L', '*')

to sort in that order: Z A L B C D ......

wildmatch sorts first Z A L;  the other chars (* in wildmatch) are sorted by text order (you flag text)   

nihhalmca
Specialist II
Specialist II
Author

Thanks for reply,

Its working some what not up to mark, after little changes

match(Expense,'Z','A','L',Expense)