Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Else condition in pick match.


Hi,

i have expression like if(status=A,green,

if(status=B,Amber,

if(status=C,Red,Grey))).

How can we rewrite this Expression using Pick(Match) function for else condition also.

Regards,

Piyush Jain

1 Solution

Accepted Solutions
Gysbert_Wassenaar

pick(match(status, 'A', 'B', 'C')+1, 'Grey', 'green', 'Amber', 'Red')


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

pick(match(status, 'A', 'B', 'C')+1, 'Grey', 'green', 'Amber', 'Red')


talk is cheap, supply exceeds demand

View solution in original post

VishalWaghole
Specialist II
Specialist II

Hi Piyush,

PFA..........

- Regards,

Vishal

Not applicable
Author

Hi Piyush,

Hope i think help this,

Dev01:

LOAD * Inline

[

Flag,Color

R,RED

G,GREEN,

B,BLUE

Y,YELLOW

];

LOAD Pick(Match(Flag,'R','G','B','Y','W'),Color,Color,Color,Color,Color) as Mat_Val Resident Dev01;

Regards,

Raj.

Not applicable
Author

Hi Vishal,

Thanks for your suggestion. but if i am not selecting anyfied the text box is showing null. it must show 'grey
'.

Regards

Piyush

Not applicable
Author

Hi Gysbert,

Please bear with me for very basic question.

Could you please explain how +1 is working in below function.

pick(match(status, 'A', 'B', 'C')+1, 'Grey', 'green', 'Amber', 'Red')


Many Thanks

Gysbert_Wassenaar

In the case a status other than A, B or C is encountered the match function will return 0 because there is no match. To make sure the pick function will return something it's necessary to add 1 to the result of the match function since the pick function cannot pick the 0-th value in a list. The first parameter of the pick function must be larger than 0.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you so much

Its clear to me now

Regards,

Pooja