Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to execute one action or another depending on the result of a tJava component.
If the job runs before 15:00, the trigger (if_10_15) will be executed.
If the job is executed after 15:00, it will be the trigger (if_15_18) that will be executed.
I do not know how to do this. I put an exit in each of my conditions of my tJava (row1.etat) and connected it via a trigger "Run if" containing the conditions if (row1.etat == -1), if (row1.etat == 0) and if (row1.etat == 1).
But I have some errors.
If anyone could show me the right way, it would be nice.
Thank you in advance.
My tJava code :
SimpleDateFormat dateformat = new SimpleDateFormat("hh:mm");
Date hLim = dateformat.parse("15:00");
String pattern = "HH:mm";
Date hNow = new Date();
int etat = TalendDate.compareDate(hNow, hLim, pattern);
// Faire passer la valeur de etat en argument au "Trigger Run if"
if (etat == -1){
System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
row1.etat = etat;
}
if (etat == 0){
System.out.println(etat + " / " + hNow + " / " + " Tournée demain matin");
row1.etat = etat;
}
else if (etat == 1){
System.out.println(etat + " / " + hNow + " / " + " Tournée demain après-midi");
row1.etat = etat;
}
My job structure :
Hello,
What's the error are you getting when you use tJava custom code in your job?
Here is a component tWaitForFile which iterates on a directory and triggers the next component when the defined condition is met.
https://help.talend.com/reader/HP30FGhc6Q9LiHefZVu4yw/xygPn~ESNbYiVEUQlhIr9A
Best regards
Sabrina