Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to check if a specific field value is selected

Hi,

I have a field, [Alphabet], with values [a,ab,abc,abcd,abcde,...].

I want to be able to tell if 'a' is selected. But my usual technique,

if(SubStringCount(Concat([Alphabet], ', '), 'a')>0, etc., etc.),

doesn't work because if 'abc' is selected while 'a' is not, SubStringCount will still return a value greater than 0.

Anyone have a solution for this dilemma?

Thanks and best regards,

Ryan

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Right, for that use:

=SubStringCount( Concat(DISTINCT Alphabet&'%'), 'a%')

View solution in original post

8 Replies
tresesco
MVP
MVP

Simply, [Alphabet]='a'   ?

Not applicable
Author

If there's multiple values selected for [Alphabet], though, this will not work; e.g., if 'a' and 'ab' are selected, [Alphabet]='a' returns false.

SunilChauhan
Champion II
Champion II

left([Alphabet],1)='a'

or

wildmatch([Alphabet],'a*')

hope this helps

Sunil Chauhan
maxgro
MVP
MVP

perhaps

=if(SubStringCount('@' & Concat([Alphabet], '@') & '@', '@a@')>0, 'a','not a')

tresesco
MVP
MVP

Right, for that use:

=SubStringCount( Concat(DISTINCT Alphabet&'%'), 'a%')

MK_QSL
MVP
MVP

=IF(INDEX('|'&Concat(Alphabet,'|'),'|a|'), 'Yes','No')

Not applicable
Author

Many thanks.

jerem1234
Specialist II
Specialist II

You can also use:

=if(max(match(Alphabet, 'a')), ..., ...)

Hope this helps!