Page 1 of 1

Implementing OR condition

Posted: Tue Sep 14, 2010 8:19 am
by Pk39565
Hi,

I am new to Datastage PX and wanted to know how to implement OR condition.

I have 3 lookup's to make on 3 different files. If record is not not found in first lookup i should not drop or reject the record , i have to continue to search in other 2 lookup's.

Can i implement with single lookup stage or join stage OR i have to use 3 stages to make lookup on 3 files by specifying inner join.

Regards
DK.

Re: Implementing OR condition

Posted: Tue Sep 14, 2010 8:41 am
by nirdesh2
It can be implement in different ways based on requirment.
You can use 3 lookup stage.
In first lookup,lookup on first file and reject the unmatched record.
In second stage, lookup only for rejected record and reject the unmatched record.
in third stage, lookup the rejected records from second lookup.
Then use the funnel stage to collect all the matching records from 3 loopup stages.

Posted: Tue Sep 14, 2010 8:49 am
by kumar_s
Or you can do this in single lookup stage and three lookup dataset.
Do lookup against all the three reference with the corresponding key.
With "Keep" option on Lookup failure.
And use transformer to find the lookup match in the order you need and do the business later.

Posted: Tue Sep 14, 2010 4:49 pm
by Pk39565
HI,

First ption is ok. In second option in transformer how can i know is lookup passed or failed. In lookup datasets i have only Key column (sigle column).

If lookup pass in any of the 3 lookup files , i have to write one column coming from source to another file which will be used in different job.


Regards
Prannet.

Posted: Tue Sep 14, 2010 5:01 pm
by ray.wurlod
What happens if lookup succeeds in two or more lookups?

Just implement the appropriate logic in the Transformer stage downstream of the lookups.

Posted: Tue Sep 14, 2010 5:03 pm
by ray.wurlod
What happens if lookup succeeds in two or more lookups?

Just implement the appropriate logic in the Transformer stage downstream of the lookups.

Posted: Tue Sep 14, 2010 5:08 pm
by Pk39565
HI,

First ption is ok. In second option in transformer how can i know is lookup passed or failed. In lookup datasets i have only Key column (sigle column).

If lookup pass in any of the 3 lookup files , i have to write one column coming from source to another file which will be used in different job.


Regards
Prannet.

Posted: Tue Sep 14, 2010 6:33 pm
by prakashdasika
You can do the three looks ups in three different lookup stages with the 'lookup failure' condition as continue. You are then affectively doing a left outer join on all three stages, you can capture flags in the three lookupsatges that meet the criteria and apply the required condition in a transformer. This gives you more flexibility.

Posted: Wed Sep 15, 2010 8:23 am
by kumar_s
Try adding a dummy column in the references. And you can use the dummy column to check the lookup condition.
If you cant add the dummy column...
Then, you may need three lookup stages.
On failure of the first lookup, reject the recorcs to second.
On failure of second lookup, reject the records to third.
Finally Funnel them all all up to do your business logic.