Tuesday, June 30, 2020
Talend: If Else Condition on tMap
In the recent ETL routine on the Talend job I had to compare two dates and select the greater one.
You have many predefined functions available on expression builder, I used TalendDate.compareDate function to compare the dates and If else condition to get the max one.
Open the expression builder by clicking on three dots
You have many predefined functions available on expression builder, I used TalendDate.compareDate function to compare the dates and If else condition to get the max one.
Open the expression builder by clicking on three dots
Select the TalendDate.compareDate function and drag the date variables from the list
TalendDate.compareDate(row2.ASS_START_DATE,row7.MGR_START_DATE)==-1?row7.MGR_START_DATE:row2.ASS_START_DATE
Here, compareDate returns -1 if argumen1 is less than argument1
== represents IF, ? represents THEN and : represents ELSE here
Note: You use == for integer and .equals("") for string output.
Ex: row2.status.equals("Active")?"Select":"Ignore"
Subscribe to:
Posts (Atom)