Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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!

1 Solution

Accepted Solutions
sunny_talwar

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

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

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

Not a problem

I am glad I was able to help.

Best,

Sunny