Page 1 of 1
How to parameterize column name in transformer constraint
Posted: Thu Jun 02, 2011 7:31 am
by madsongtel
Hi All,
My requirement is I want to pass column name with some value as parameter (Lnk_In.EMP_ID=1234)in transformer constraint.
When I tried with that job is completed successfully, but no records are passing to output.
Could you please help me.
Posted: Thu Jun 02, 2011 7:41 am
by rschirm
Please provide more detail. Such as what you are physically placing in the constraint and how is the parameter getting set and with what value.
Posted: Thu Jun 02, 2011 8:36 am
by madsongtel
My job is like Dataset ---->Transformer--->Dataset
At run time for parameter first time i will give like EMP_ID=123 Or EMP_ID=234 Or EMP_ID=456
when i run second time i will give like EMP_NAME='AAA'
when i run thirs time i will give like GRADE='AA'
depends on the requiremnt i will pass at run time.
How can i do this in transformer. We can do this by using filter stage also.
Posted: Thu Jun 02, 2011 9:01 am
by rschirm
The problem with using a job parameter is it takes the value specified and treats as a string. And since the string value that you are passing is not TRUE the rows will not go out. This can be accomplished by doing the following:
First set up 2 Job Parameters; a=column name, b=value
StageVariable1 = If JobParamA = 'name' then link.name else if JobParamA = 'grade' then link.grade else .... (continue on for each column possibility with the ending else = "")
StageVariable2 = if StageVAriable1 = JobParamB then 1 else 0
Then use StageVariable2 as the constraint on the output link.