Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone !
I have a problem with inserting a while loop that would contain a Subjob of data extraction.
My query retrieves records between two dates. I have to add 10 days to a date if my request does not return any records. You have to be able to do it X times before getting out of the loop. If at least one record is returned, I leave the loop.
The idea is to do:
int i; while (i = 0; i <4; i ++) { \\\\\\\\\\\\\\\subjob////////////// int nbRow = ((Integer) globalMap.get ("tOracleOutput_2_NB_LINE")). intValue (); if (nbRow! = 0) break; else { context.DateMax= TalendDate.addDate (context.sDateMax, 10, "dd"); context.sDateMax= TalendDate.formatDateLocale ("dd-MMM-yyyy hh: mm: ss", context.sDateMax, "EN"); } }
Here is my subjob:
Obviously, it doesn't work so...did anyone know how to do this?
Thanks for your time !!
The while loop in your Java component will execute in its entirety before moving on to the next subjob. If you want to control execution of other components, you can use the tLoop component. Set the Condition setting to a globalMap boolean variable containing false. A Java component inside the loop can check the conditions and set the globalMap variable to true when you want the loop to end.
The while loop in your Java component will execute in its entirety before moving on to the next subjob. If you want to control execution of other components, you can use the tLoop component. Set the Condition setting to a globalMap boolean variable containing false. A Java component inside the loop can check the conditions and set the globalMap variable to true when you want the loop to end.
Thanks for your quick answer. It works great !