concat colmns in transformer if condition happens

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sangi1981
Participant
Posts: 99
Joined: Fri Jun 13, 2008 8:10 am

concat colmns in transformer if condition happens

Post 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
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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 '')
-craig

"You can never have too many knives" -- Logan Nine Fingers
sangi1981
Participant
Posts: 99
Joined: Fri Jun 13, 2008 8:10 am

Post by sangi1981 »

So simple!
Thanks
Post Reply