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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
chris1987
Creator
Creator

Search for Characters in string - WildMatch() / Match() or other

Hi,

I have a field that contains codes (relevant to the company I work for). I want to search this field to determine if it contains any character in a specified array.

What I would usually do in excel is:

    

     $AS2 = "GCBZ"

    IF(COUNT(SEARCH({"A","R","C"},$AS2,1))>0,"Found it, do this!","Not Found - Try again!")

     This would return "Found it, do this!" as the cell contains "C"

I can repeat the above in QV but only by doing the following:

    

     [ProgStage]) = "GCBZ"

     IF(WILDMATCH(UPPER([ProgStage]),'A*','*A*','*A'.'R*','*R*','*R','C*','*C*','*C')>0,"Found it, do this!","Not Found - Try again!")


Is there any way I can do the above formula without repeat three instances of each character - sometime I have to search for 15 different characters - 45 options.

The letters will not always appear in the same order and may or not be at the beginning / end of the string. I've also tried using index() but obviously this is for one search string.

Any help would be appreciated.


Thanks in advance

Chris

   

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What about FindOneOf() string function?

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If(Len(ProgStage)>len(PurgeChar(UPPER(ProgStage),'ARC')),'Found it, do this','Not Found - Try again!')


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

What about FindOneOf() string function?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If(  FindoneOf(ProgStage,'ARC')  ,'Found it, do this','Not Found - Try again!')


-Rob

http://masterssummit.com

http://qlikviewcookbook.com