Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Searching for a specific string

Hi All,

I have a question regarding searching for a specific string.

Lets say I have data:

table1:

KEYCODE
ABCAB
DEFDE
XYZXY

table2:

KEYFIELD1
ABCG-H-G-H-G-A-B-AB-ABC
DEFAB-AB-DE-EF
XYZABC-XY-QYZ

In Key ABC, I have to find the CODE (AB) in FIELD1 (G-H-G-H-G-A-B-AB-ABC).

How do I do this?

Thanks,

Lyn

1 Solution

Accepted Solutions
sudeepkm
Specialist III
Specialist III

you can use like below. Please find the attachment.

if(SubStringCount(FIELD1,CODE)>0,'PRESENT','ABSENT') as CODEFLAG

T119445.png

View solution in original post

5 Replies
Roop
Specialist
Specialist

How about:

FindOneOf(text , characterset [ , n])

so in your example,

FindOneOf('AB', FIELD1)

if zero is returned it cannot find it.

alexandros17
Partner - Champion III
Partner - Champion III

Try this code

TMP:

NoConcatenate

Load * resident Table1;

join

Load * resident Table2;

TABLE:

LOAD *, If(WildMatch(CODE, FIELD1) > 0, 'OK', 'NO') as is_in_field Resident TMP;

DROP Table TMP;

Not applicable
Author

And how should your result look like? You need to show starting position of this CODE in FIELD1?

sudeepkm
Specialist III
Specialist III

you can use like below. Please find the attachment.

if(SubStringCount(FIELD1,CODE)>0,'PRESENT','ABSENT') as CODEFLAG

T119445.png

Not applicable
Author

Hi,

thanks this is what I'm looking for. My other question is, what if field1 contains ACB instead of ABC, how can I fix it in alphabetical order?

Thanks,

Lyn