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

Using WildMatch and another field as the expression

I am trying to see if there is a way to use another field within a LOAD in a WildMatch function.

I have a field that contains a number and some other characters like "1234_testing_iso" or "12345_impala_pad" and then I have another field which is essentially a cost code such as "1234" or "2345".

I am trying to see if I can make a WildMatch function using the second field as the expression to reference.

Field1 = 1234_testing_iso or 12345_impala_pad

Field2 = 1234 or 12345

What I had in mind would be something like:

IF(WIldMatch(Field1,'*(Field2)*'),'Match','No Match')

If it was comparing "1234_testing_iso" to field 2 (1234) there would be a "Match". Comparing it to (2345) would get "No Match".

Comparing "12345_impala_pad" to (1234) would be a "Match" and compared to (2345) would also be a "Match"

Ideas?

1 Solution

Accepted Solutions
sunny_talwar

‌My bad, try this

If(WildMatch(Field1,'*' & Field2 & '*'), 'Match', 'No Match')

View solution in original post

10 Replies
sunny_talwar

May be this

If(WildMatch(Field1,'*Field2*'), 'Match', 'No Match')

dawgfather
Creator
Creator
Author

I tried that but then it was taking the actual name of "Field2" and looking for F-I-e-l-d-2 in the string instead of Field2 as a "variable"

sunny_talwar

‌My bad, try this

If(WildMatch(Field1,'*' & Field2 & '*'), 'Match', 'No Match')

sasiparupudi1
Master III
Master III

May be like this??

Test:

Load F1,

F2,

if(SubStringCount(F1,F2)>0, 'Match','NoMatch') as Result1;

//if(KeepChar(F1,'0123456789')=F2, 'Match','NoMatch') as Result2;

Load * Inline

[

F1,F2

1234_testing_iso,1234

12345_impala_pad,2345

];

mrichman
Creator II
Creator II

Hi Sunny,

What if Field1 and Field2 are from seperate tables?

I have two separate tables, 1st with keywords and the 2nd with Description, both tables cannot be joined

Thanks in advance,.

sunny_talwar

Would you be able to share a sample to show how everything looks?

mrichman
Creator II
Creator II

i'm trying to find keywords in the description, if exist then return 1 if not then 0 for example.

Data1:

Load* Inline [

Keyword,

Mark,

Benjamin,

Jose,

];

Data2:

Load* Inline [

Description,

Mark Simon,

Gabby Caprio,

Nico Jose,

];

Thanks in advance.

mrichman
Creator II
Creator II

Hi Sunny,

Thanks for you prompt reply. I was hoping for a keepchar() solution however the function cannot identify words but only characters (Char) . Furthermore, because it can only check characters, I cannot check whether the functions can compare from one table to another.

Do you maybe know what kind of solution I can use or maybe I'm not using the function correctly.

Thanks in advance.