Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bharath28
Creator
Creator

pick and match with variable

Hi Experts,

I am using match function to expand a variable in 2nd parameter and give the position and the pick function to expand and return the result of the variable.

='Sales by ' & Pick(match(GetCurrentField([Group]),'No','=''$(vProdAlias)'''),'No1','=''$(vProdAlias)''')


Thanks!

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this expression:

='Sales by ' & Pick(Match(vGroup, 'No', '=' & Chr(39) & chr(36) & '(vProdAlias)' & Chr(39)),'No', vProdAlias)

View solution in original post

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

This should do it:

='Sales by ' & Pick(Match(GetCurrentField([Group]), 'No', '$(vProdAlias)'), 'No1', '$(vProdAlias)')

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

Hi Jonathan,

Thanks for the reply. However the expression is still not working.

Could you please use the app

sunny_talwar
MVP
MVP

Try this expression:

='Sales by ' & Pick(Match(vGroup, 'No', '=' & Chr(39) & chr(36) & '(vProdAlias)' & Chr(39)),'No', vProdAlias)

bharath28
Creator
Creator
Author

Thanks a lot Sunny! It is working

Just to have a better understanding could you please tell me why chr().

I understand that we have to store ='$(vProdAlias)' as string. But why it doesnt work with escape characters-

'=''$''(vProdAlias)'''''

But it works with your solution(with chr())??

'=' & Chr(39) & chr(36) & '(vProdAlias)' & Chr(39)

sunny_talwar
MVP
MVP

Chr(36) is a dollar sign which doesn't get evaluated, but $ this gets evaluated. That's the way it works, don't really know why though

Best,

Sunny

bharath28
Creator
Creator
Author

Thanks for the help!

sunny_talwar
MVP
MVP

Not a problem

I am glad I was able to help.

Best,

Sunny