Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

linoybar
Contributor III

String variable in match function in expression

Hi, I have a variable vRelevantBusinesses returning me a list of string values of a field "Business":

vRelevantBusinesses_temp: Concat(distinct Business,',')

vRelevantBusinesses: Chr(39) & Replace($(vRelevantBusinesses), ',', Chr(39) & ',' & Chr(39)) & Chr(39)


The vRelevantBusinesses variable output is 'a','b','c'


I need to write set analysis using match function and the vRelevantBusinesses variable output but it doesn't work:

=If(match(Business, $(vRelevantBusinesses)), Business)


Without the variable it works:

=If(match(Business, 'a','b','c), Business)


Please help on getting this to work: =If(match(Business, $(vRelevantBusinesses)), Business)


Sample app is attached.


Thanks!

1 Solution

Accepted Solutions
pradosh_thakur
Honored Contributor II

Re: String variable in match function in expression

pfa

=chr(39) & concat(distinct Business,chr(39)&','&chr(39)) & chr(39) as variable.

https://community.qlik.com/blogs/qlikviewdesignblog/2014/11/24/the-equal-sign

a good read

regards

Pradosh

Learning never stops.
13 Replies
pradosh_thakur
Honored Contributor II

Re: Match + string variable in set analysis

try this

=If(match(Business, $(=vRelevantBusinesses)), Business)


Learning never stops.
linoybar
Contributor III

Re: Match + string variable in set analysis

Thanks, but no, that doesn't work either.

pradosh_thakur
Honored Contributor II

Re: Match + string variable in set analysis

try

chr(39) & concat(distinct Business,chr(39)&','&chr(39)) & chr(39) as varibale

Learning never stops.
linoybar
Contributor III

Re: Match + string variable in set analysis

Your variable is great and it returns the same output which is 'a','b','c'

The problem is when using this variable in match function

pradosh_thakur
Honored Contributor II

Re: String variable in match function in expression

which object are you using this expression? if possible post a sample.

Learning never stops.
linoybar
Contributor III

Re: String variable in match function in expression

Bar chart

pradosh_thakur
Honored Contributor II

Re: String variable in match function in expression

please post a sample. working for me when i am trying in my app.

Learning never stops.
linoybar
Contributor III

Re: String variable in match function in expression

I've attached the sample to the initial posting, thanks

Re: String variable in match function in expression

Try this

=If(match(Business, $(=$(vRelevantBusinesses))), Business)

Community Browser