Page 1 of 1

Lookup logic

Posted: Thu Jul 08, 2010 1:53 pm
by mail2hfz
Hello All,

I have a requirement where-in I have to lookup for each word in a field against a table and fetch the value from the table if a match is found else pass the source value as is. I have searched in the forum but could not get a direction.

Code: Select all

Eg: Sample Input
Field1   ==> one of the col in the file
"ABC is Techie giant"

Reference Table:
Field1         Field2
ABC           DEF
Techie        GHI
giant          KLM

Expected output:
"DEF is GHI KLM"
I have started with, splitting the Field1 in i/p into multiple columns and then copy Filed1 in reference table into multiple columns for lookup but did not seem to work. May be the hard way of doing it is seperate lookups for each word found!!! I am not sure.

Can anyone shed some light on this or direct me to a post where this is discussed before.

Thanks

Posted: Thu Jul 08, 2010 2:39 pm
by mail2hfz
I am able to get this done with seperate lookups. Would like to know if any other way I can achieve it.

Posted: Thu Jul 08, 2010 2:56 pm
by Sainath.Srinivasan
Break one record with multiple words into multiple records with one word each. Include row number and word number to each record.

Do a lookup and join them back together.

Also search for TRANS() function to perform lookup inside code.

Posted: Thu Jul 08, 2010 4:50 pm
by ray.wurlod
mail2hfz wrote:I am able to get this done with seperate lookups. Would like to know if any other way I can achieve it.
No. According to your explanation each word/token must be looked up individually.

Posted: Fri Jul 09, 2010 1:29 pm
by grimm336
After splitting the sentence in to columns try to validate each column one by one with the reference data....

Then use tranformer to get the sentence from the columns...you know how to do this

cheers....