Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
EricDraven
Contributor II
Contributor II

String Search

I have a field that has multiple codes inside of the field (Example: *Code1 *Code2    *Code4 *Code5). I want to search through each of them record to find only the ones that do not have one Code Number. (Example: *Code 4). The field is random with no structure so sometimes *Code3 is before *Code1 and others it is not. Also, there are random spaces in-between the codes if codes are missing from the string. (In the example I am missing *Code3 which is why there is three spaces there.) Can this be done?

1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Something like this ?

AshutoshBhumkar_0-1635396232950.png

Expression Used : If(WildMatch(UserCode,'*Code1*') and WildMatch(UserCode,'*Code4*') and WildMatch(UserCode,'*Code5*') , UserName,0)

 

Check if that works for you.

Thanks,

Ashutosh

View solution in original post

5 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

Quite not clear with the question. Can you please elaborate more ?

 

Thanks,

Ashutosh

EricDraven
Contributor II
Contributor II
Author

Yes I will use what I have tried.

Field name is UserCodes - contains codes a user may have

Field Name UserName - contains the username of the person

UserName UserCode
User 1 *Code1 *Code2 *Code3 *Code4 *Code5
User 2 *Code5 *Code2 *Code4   *Code1
User 3 *Code1
User 4 *Code1      *Code4 *Code5 
User 5 *Code5   *Code1   *Code4 

 

I want to pull the people that have *Code1, *Code4, and *Code5. I have tried to use the following.

if(Wildmatch(UserCode,'*Code1*','*Code4*','*Code5*')>0,UserName).

But, it only gives me if those codes are in the field UserCode.

I need to return the Username if all the codes are in there only. These codes can be in any order and can have other codes in-between them.

If User has UserCode of *Code1, *Code4, and *Code5  would return

User1, User2, User4, and User5

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Something like this ?

AshutoshBhumkar_0-1635396232950.png

Expression Used : If(WildMatch(UserCode,'*Code1*') and WildMatch(UserCode,'*Code4*') and WildMatch(UserCode,'*Code5*') , UserName,0)

 

Check if that works for you.

Thanks,

Ashutosh

EricDraven
Contributor II
Contributor II
Author

Forgot to update you. Yes this worked. Thank you.

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Great 🙂