Page 1 of 1

Lookup with constraint

Posted: Wed Aug 25, 2010 9:36 am
by harryhome
Hi Need to look up a value with constraint(as in stream records start date and end date should be between reference records start date and end date)

In look up stage, doesn't seems to do the comparision in my case, is there any other way to do look up with constraint

Main stream data has ID, start_date and end_date
and reference stream data has ID, start_date and end_date

Main steam will look up on ID where start_date and end_date is between reference data start_date and end_date

Posted: Wed Aug 25, 2010 9:40 am
by anbu
Use range lookup for start_date and end_date

Posted: Wed Aug 25, 2010 9:57 am
by kris007
You can do a lookup on ID field and use a Filter/Transformer Stage downstream to apply the conditions.

Code: Select all

Stream.StartDate > Reference.StartDate and Stream.StartDate < Referece.EndDate And Stream.EndDate > Reference.StartDate And Stream.EndDate < Reference.EndDate
Hope that helps.

Posted: Thu Aug 26, 2010 1:15 pm
by harryhome
anbu wrote:Use range lookup for start_date and end_date

Tried using same getting error in compilation as

##E IIS-DSEE-TFKL-00079 15:08:02(009) <transform> Error when checking composite operator: Error parsing range option. Comparison operators can't be of the same type "Main.EFF_DT >= reference.EFF_DT AND Main.EXP_DT >= reference.EFF_DT"
##E IIS-DSEE-TFKL-00079 15:08:02(010) <transform> Error when checking composite operator: Error parsing range option. Comparison operators can't be of the same type "Main.EFF_DT <= reference.EXP_DT AND Main.EXP_DT <= reference.EXP_DT"

EFF_DT is Start date
EXP_date is End date

Posted: Thu Aug 26, 2010 1:32 pm
by anbu
Try this

Code: Select all

Main.EFF_DT >= reference.EFF_DT AND Main.EFF_DT <= reference.EXP_DT
Main.EXP_DT >= reference.EFF_DT AND Main.EXP_DT <= reference.EXP_DT

Posted: Thu Aug 26, 2010 1:45 pm
by harryhome
anbu wrote:Try this

Code: Select all

Main.EFF_DT >= reference.EFF_DT AND Main.EFF_DT <= reference.EXP_DT
Main.EXP_DT >= reference.EFF_DT AND Main.EXP_DT <= reference.EXP_DT
I can not edit look up range expression.
Main.EFF_DT >= reference.EFF_DT AND Main.EXP_DT >= reference.EFF_DT
This means I am comparing eff_dt and exp_dt from main to eff_dt of reference in lookup stage

Posted: Thu Aug 26, 2010 1:51 pm
by kris007
Did you try doing that in a Transformer/Filter stage downstream?

Posted: Thu Aug 26, 2010 2:28 pm
by harryhome
kris007 wrote:Did you try doing that in a Transformer/Filter stage downstream?
yes , so wen lookup on ID only , multiple entries are present in reference table for a ID then only one entry gets picked up and other wont

and lookup stage has option to return multilple row only for one reference link. not more for more than one link

Posted: Thu Aug 26, 2010 4:05 pm
by ray.wurlod
EACH lookup stage has option to return multilple row only for one reference link.
:idea:

Posted: Thu Aug 26, 2010 4:53 pm
by kris007
harryhome wrote: lookup stage has option to return multilple row only for one reference link. not more for more than one link
So, do you have more than one reference link (which you did not mention in your first post)?

Posted: Fri Aug 27, 2010 8:06 am
by harryhome
yes i have more than one reference link, i am planning to use one lookup stage for one reference link and then carry forward result to 2nd lookup with 2nd reference link

Posted: Mon Oct 11, 2010 2:18 am
by agpt
harryhome wrote:
kris007 wrote:Did you try doing that in a Transformer/Filter stage downstream?
yes , so wen lookup on ID only , multiple entries are present in reference table for a ID then only one entry gets picked up and other wont

and lookup stage has option to return multilple row only for one reference link. not more for more than one link
Could you please tell me which option exactly let us return multiple rows if input has one row but reference data has multiple rows on key column?

Posted: Mon Oct 11, 2010 3:00 am
by ArndW
In the lookup stage, double-click on the Condition or right-mouse-click on the left pane and choose "conditions" and you will see a drop down box on the top left of the window that allows you to choose the link from which multiple rows can come.

Posted: Mon Oct 11, 2010 4:07 am
by agpt
ArndW wrote:In the lookup stage, double-click on the Condition or right-mouse-click on the left pane and choose "conditions" and you will see a drop down box on the top left of the window that allows you to choose the link from which multiple rows can come.
Andy,

Let me give the exact example what I want:

I have input as :

ID
1
2
3
4

Reference data to be looked upon as:
ID vara
1 A
2 B
2 B
3 C
4 D
4 D

The normal output from lookup wuld have:

ID vara
1 A
2 B
3 C
4 D

but the output I want:

ID vara
1 A
2 B
2 B
3 C
4 D
4 D

i.e. multiple records if reference has multiple records. Would this "conditions" would handle it?

Posted: Mon Oct 11, 2010 4:13 am
by ArndW
Yes.