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: 
SerSwagster
Creator
Creator

Checking multiple values in a string

Hi everyone,

I want to know if it is possible to check the presence of multiple "values" within a string.

This is my case. I have a column called COLORS filled with these records (each of them is a singular string):

green,blue

red,green

red,blue,yellow

yellow,blue,red

yellow,red,blue,green

green,red,blue

...

If I want to control that a specific color (e.g. green) is not present in the string, I do this:

if(not wildmatch(COLOR, '*green*'), 'check', 'ok')

What should I do to control multiple colors in the same string? I can't do like this ('*green,blue*') because sometimes the values are written in a different order and so the string is different.

Any suggestion?

13 Replies
rwunderlich
MVP
MVP

I got my parens in the wrong place

if(WildMatch(COLOR,'*yellow*','*orange*','*green*','*red*','*blue*')
and not WildMatch(COLOR,'*yellow-*') , 'check', 'ok')

-Rob

SerSwagster
Creator
Creator
Author

It still give me no result.

rwunderlich
MVP
MVP

Can you post some sample data and the results you are seeing?

-Rob

SerSwagster
Creator
Creator
Author

I have solved the issue in this way. Anyway, thanks a lot.

if(Left(NAME, 5) = '2019_' and WildMatch(COLOR,'*yellow-orange*','*green-blue*'.), 'check',
if(Left(NAME, 5) = '2022_' and WildMatch(COLOR,'*yellow,*','*yellow','*orange,*','*green*','*red*','*blue*'), 'check', 'ok'))