Page 1 of 1

concat colmns in transformer if condition happens

Posted: Mon Nov 08, 2010 5:50 am
by sangi1981
Hi, I am writing for advice.
In a transformer, I carry out checks on inputs, for example on the formal correctness of the dates.
I have to concatenate in a new column in output, only the values of columns that do not pass the checks I mentioned above.
I use the variables stage, but I do not know how to concatenate input columns, under a condition true / false.
I would get something like this:

Code: Select all

 stageVar = "(if check1 = 1 then col1 else'') concatenated with (if check2 = 1 Then col2 else'') concatenated with (if check3 = 3 then col3 else'') etc" 
.
Is possible and how?!
Thank you very much

Posted: Mon Nov 08, 2010 6:25 am
by nitkuar
if your IF conditions are finite, then create separate stage variable for each IF condition. Finally concatenate all stage variables in new column derivation.

Posted: Mon Nov 08, 2010 7:38 am
by chulett
Or just do it like you have posted:

Code: Select all

stageVar = (if check1 = 1 then col1 else '') : (if check2 = 1 Then col2 else '') : (if check3 = 3 then col3 else '')

Posted: Mon Nov 08, 2010 7:47 am
by sangi1981
So simple!
Thanks