简体   繁体   中英

check if condition is met then do a lookup

I'm trying to do a parallel job wherein I check the value of a column where in if it matches a certain condition it returns a certain value and if does not it will check on another condition and if it matches that condition it will do a lookup. I'm not sure where to put the condition if it will be on the reference link or the output link.

Here is a pseudocode of some sort to hopefully makes is clearer:

if (table1.colname = NULL OR table1.colname = '')
  then '999'
else 
  if table1.column = 0
     then do a lookup on table2.colname for '1' return table2.colname2
  else
     do a lookup on table2.colname for '2' return table2.colname2
  if value is not found then '999'

I'm kinda new to datastage, so any comments or idea are greatly appreciated. And please do let me know if you need other clarifications. Thank you.

Use Transformer or Filter to split the records into three links based on the condition

First Link : Records containing Null or Empty Second Link : Records containing Value Zero third Link : Otherwise ( Remaining records)

Then do the look up on second and third link seperately as per the requirement Then Funnel the output from First link and the outputs from Look up Use transformer to apply the fourth condition for non matching records

     Or

In transformer create a new field in which write condition like

If NullToEmpty(table1.column)='' then "DefaultValue"(Make sure that the value u are assigning should not have the matching records in reference table)

Else If table1.column = 0 then "1" Else If table1.column = 1 then "2" Else "Defaultvalue"

Then do the lookup on this new field with the table2.colname2 and assign "999" in the transformer for the lookup not found records

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM