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: 
nchamilton
Contributor II
Contributor II

Dynamic string search

Good morning,

I'm attempting to search a vendor table (vendor_name) and flag the vendor_name anytime the employee name shows up in the vendor name. I want to do this dynamically.

Example:

I would like to create a flag that flags the vendor_name anytime the emp_name is found in the vendor_name. 

Employees:
Load * Inline [
emp_name
Jon Smith
Bob Thompson

];

Vendor:
Load * inline [
vendor_name
Jon Smith Inc
Bob Thompson LLC
Jones Co.

];

Expected Results:

vendor_name employee_check flag
Jon Smith Inc Jon Smith 1
Bob Thompson LLC Bob Thompson 1
Jones Co.   0
Jon Smith LLC Jon Smith 1

 

Any assistance would be greatly appreciated.

 

 

Labels (2)
2 Solutions

Accepted Solutions
p_verkooijen
Partner - Specialist II
Partner - Specialist II

You could concatenate the employeenames to a string and use this as a wildmatch.

WildMatch:
LOAD 
   CHR(39)&'*'&CONCAT(emp_name, '*'&CHR(39)&','&CHR(39)&'*')&'*'&CHR(39) AS WildMatchValues
RESIDENT Employees;
 
LET WildMatchValues=Peek('WildMatchValues',0,'WildMatch');
 
MatchVendor:
LOAD
*,
IF(WILDMATCH(vendor_name, $(WildMatchValues)), 1, 0) AS flag
RESIDENT Vendor;
 
DROP TABLE Vendor;
SET WildMatchValues;
 
p_verkooijen_1-1717593686826.png

 


 

View solution in original post

3 Replies
p_verkooijen
Partner - Specialist II
Partner - Specialist II

You could concatenate the employeenames to a string and use this as a wildmatch.

WildMatch:
LOAD 
   CHR(39)&'*'&CONCAT(emp_name, '*'&CHR(39)&','&CHR(39)&'*')&'*'&CHR(39) AS WildMatchValues
RESIDENT Employees;
 
LET WildMatchValues=Peek('WildMatchValues',0,'WildMatch');
 
MatchVendor:
LOAD
*,
IF(WILDMATCH(vendor_name, $(WildMatchValues)), 1, 0) AS flag
RESIDENT Vendor;
 
DROP TABLE Vendor;
SET WildMatchValues;
 
p_verkooijen_1-1717593686826.png

 


 

nchamilton
Contributor II
Contributor II
Author

These are both great. Thanks so much.