tloop never ends

Four Stars

tloop never ends

Hi,

I want tloop component to run until the count of records from MySQL component(Talend_Statistics_READ) =4 and once the condition is met, I want the remaining ETL to run.
But in my case when count =4, the loop is not ending and thereby running the remaining ETL multiple times.
I tried to modify the condition in tloop component but can't get it to work as required. When I set the condition
as ((Integer)globalMap.get("tMysqlInput_2_NB_LINE")==4), Job starts and ends immediately.
Any ideas.
Thanks,
anut
Five Stars

Re: tloop never ends

Assuming you have the correct globalMap key and the correct number of rows are being returned, it looks okay to me.
I'd check the Java code to ensure that looks okay...
while (((Integer) globalMap.get("tMysqlInput_2_NB_LINE") <= 4)) {
...
globalMap.put("tMysqlInput_2_NB_LINE", nb_line_tMysqlInput_1);
...
}
One Star

Re: tloop never ends

if you set ((Integer)globalMap.get("tMysqlInput_2_NB_LINE")==4), job will end immediately definitely.
because you choose while condition and set declaration globalMap.put("tMysqlInput_2_NB_LINE",0)
like
int i=0;
while (i==4)
{
//loop cant be run because the condition is false
}

and without iteration, when condition is rightSmiley Sad(Integer)globalMap.get("tMysqlInput_2_NB_LINE")<=4)
loop cant be ended
So i suggest that you should re-desgin your job...
Five Stars

Re: tloop never ends

Setting aside the i==4 issue, the original requirement looked ok, to me.
Assuming that everything I couldn't see from the Job, as good.
The while expressions look a little odd; but they should translate to what seems to be required.