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: 
neha_sharma1275
Contributor II
Contributor II

Pick Match to replace IF with multiple parameters

I have this condition, how to write Pick(Match ())function to replace it ? Not sure how to use multiple parameters here. Below is the expression -

If([Cancel flag]='N' and [Cancel status]='Y', Red(),

If([Cancel flag]='Y' and [Cancel status]='N', Green()

))

8 Replies
qlikviewwizard
Master II
Master II

Apply the below example to your requirement.

Example:

Pick(WildMatch(Month, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),

    '01', '02', '03',  '04',  '05',  '06',  '07',  '08',  '09',  '10',  '11',  '12')

It will provide number value for the Month, based on the string value.

shilpan
Partner Ambassador
Partner Ambassador

pick(match([Cancel flag], 'N', [Cancel status], 'Y'), Red(),

      match([Cancel flag], 'Y', [Cancel status], 'N'), Green()


)

neha_sharma1275
Contributor II
Contributor II
Author

Hi Shilpan,

This seems to be not working. Please find attached image, the first column [Account] is where I applied the expression you provided and all other columns have my previous IF statement for colour. You can see all rows are coloured Red when used your expression which is not correct.

neha_sharma1275
Contributor II
Contributor II
Author

it is fr multiple conditions in match function, can you please provide the exact expression for the condition I mentioned?

tamilarasu
Champion
Champion

Hi Neha,

Pick(Match([Cancel flag] & [Cancel status], 'NY','YN'),Red(),Green())

jonathandienst
Partner - Champion III
Partner - Champion III

Is there any particular reason for doing so? It is possible, but the expression will be no simpler and will be less intuitive to read.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
neha_sharma1275
Contributor II
Contributor II
Author

I am trying to improve the performance of the application and as I am just looking at the optimization in front end, I thought this is one the replacements which would work and improve the performance

jonathandienst
Partner - Champion III
Partner - Champion III

I doubt you would see a detectable difference in performance, and the Pick(Match()) may even perform worse than the nested if as it is doing a more complex calculation.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein