1
votes

I have a talend job that have the following components: - 1 database input component that fetched data from the database - 1 output component that writes the fetched data into flat file.

Now, I have a scenario wherein, from two fields on the fetched data, only one should be put on in the output based on some if else logic.

Can anyone assist me in this matter? Is it using tMap?

1

1 Answers

1
votes

Your if/else logic could be put in the tMap; as a ternary operator in the output of your tMap.

condition?resultifOK:resultifKO

For example, you want to insert in your file the value of ColumnA if it is "MY CONDITION", otherwise you insert value of ColumnB :

You'll have, directly in the output row of tMap:

"MY CONDITION".equals(row1.ColumnA)?row1.ColumnA:row1.ColumnB

You can't directly use a if/else in tMap. If you have several conditions , consider using a Routine instead of multiple ternary operators.