[resolved] tFlowToIterate - on each Row: lookup and Run if condition

One Star

[resolved] tFlowToIterate - on each Row: lookup and Run if condition

Hi,
i'm creating a job like this:
dbInput1--main-->tFlowToIterate--iterate-->
-->If there is a record-->
-->else -->
To test it i substituted dbOutputs with tLogRows.
There are no syntax errors, but what i receive in tLogRows are empty rows.
tFlowToIterate has the "Use the default (key, value) in global variables" option checked.
LS_frontiera_meetings is a tMysqlInput component that search if a key exist or not.
tJava_14 has this code:
int nb=((Integer)globalMap.get("tMysqlInput_8_NB_LINE"));
if(nb>0){
globalMap.put("hasData", true);
}else{
globalMap.put("hasData", false);
}
System.out.println("rows are: "+nb);
tJava15 and tJava16 are empty, i used them just to be able to connect to tLogRows.
Why do you think i'm receiving empty rows instead of the SugarCRMInput flow?
Thanks in advance

Accepted Solutions
One Star

Re: [resolved] tFlowToIterate - on each Row: lookup and Run if condition

Hi Shong,
thank you.
I succeed:
I used a flow like this (see image) to produce a Do While Loop - and an If Else Statement based on a Query Select.
I had to import into a CRM named "LS" every new or updated meetings from a CRM named "SKY".
============
tJava_2
============
globalMap.put("tMysqlInput_5_NB_LINE", 0);
============
tJava_1
============
int nb=((Integer)globalMap.get("tMysqlInput_5_NB_LINE"));
if(nb>0){
globalMap.put("hasData", true);
}else{
globalMap.put("hasData", false);
============
LS_MEETINGS_SEL
============
"SELECT
`meetings`.`id`
FROM `meetings`
ORDER BY date_entered desc
LIMIT 1"
}
If anyone needs further explenations, just ask.
If anyone has any ideas how to improve this flow, feel free to reply.

All Replies
Community Manager

Re: [resolved] tFlowToIterate - on each Row: lookup and Run if condition

Hi
I don't understand why you use a tFlowToIterate to iterate each row if you don't use a variable in the query of tMysqlInput? Can you show us the query of tMysqlInput? And there is a job design problem, tJava_14 should begin to work after tMyslqInput finishes, the job looks like:
tSugarCRMInput--main--tFlowToIterate--iterate--tMysqlInput--main--tLogRow(or tJavaRow)-oncomponentok--tJava_14...other processing
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] tFlowToIterate - on each Row: lookup and Run if condition

Hi Shong,
thank you.
I succeed:
I used a flow like this (see image) to produce a Do While Loop - and an If Else Statement based on a Query Select.
I had to import into a CRM named "LS" every new or updated meetings from a CRM named "SKY".
============
tJava_2
============
globalMap.put("tMysqlInput_5_NB_LINE", 0);
============
tJava_1
============
int nb=((Integer)globalMap.get("tMysqlInput_5_NB_LINE"));
if(nb>0){
globalMap.put("hasData", true);
}else{
globalMap.put("hasData", false);
============
LS_MEETINGS_SEL
============
"SELECT
`meetings`.`id`
FROM `meetings`
ORDER BY date_entered desc
LIMIT 1"
}
If anyone needs further explenations, just ask.
If anyone has any ideas how to improve this flow, feel free to reply.