Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a question regarding searching for a specific string.
Lets say I have data:
table1:
| KEY | CODE |
| ABC | AB |
| DEF | DE |
| XYZ | XY |
table2:
| KEY | FIELD1 |
| ABC | G-H-G-H-G-A-B-AB-ABC |
| DEF | AB-AB-DE-EF |
| XYZ | ABC-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
you can use like below. Please find the attachment.
if(SubStringCount(FIELD1,CODE)>0,'PRESENT','ABSENT') as CODEFLAG

How about:
FindOneOf(text , characterset [ , n])
so in your example,
FindOneOf('AB', FIELD1)
if zero is returned it cannot find it.
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;
And how should your result look like? You need to show starting position of this CODE in FIELD1?
you can use like below. Please find the attachment.
if(SubStringCount(FIELD1,CODE)>0,'PRESENT','ABSENT') as CODEFLAG

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