One Star tpk
One Star

Purpose of tFlowToIterate and tIterateToFlow

Hi Team,
I was trying to understand the exact purpose of tFlowToIterate and tIterateToFlow components. I tried to understand the components by reading the documentation available for the components, but it could not help me. I didn't exactly understand the actual use.
Can any one explain me with a good scenario that can be easily understandable and grasped.
Thanks in advance for the solutions you are going to post.
Thanks and Regards,
Pavan
5 REPLIES
One Star

Re: Purpose of tFlowToIterate and tIterateToFlow

Hi Pavan
Two scenarios would explain these two components.
Scenario 1---tFlowToIterate:
Let's say we have a mysql table called tableA which contains queries like "select * from tableB". I need to extract thses queries from tableA and use them for extracting data from tableB.
tMysqlInput(tableA)--main(row1)-->tFlowToIterate--Iterate-->tMysqlInput_2--main-->tLogRow
In tMysqlInput_2, I type this expression 'row1.query' in the query text field on tMysqlInput_2 for further extraction.
Scenario 2---tIterateToFlow:
tFileList--Iterate-->tIterateToFlow-->tLogRow
How can I get all file names from the specified directory and print them on console?
Use tIterateToFlow as the following image.
Regards,
Pedro
One Star tpk
One Star

Re: Purpose of tFlowToIterate and tIterateToFlow

Hi Pedro,
Thank you for the scenarios!
Thanks and Regards,
Pavan
Hi Pavan
Two scenarios would explain these two components.
Scenario 1---tFlowToIterate:
Let's say we have a mysql table called tableA which contains queries like "select * from tableB". I need to extract thses queries from tableA and use them for extracting data from tableB.
tMysqlInput(tableA)--main(row1)-->tFlowToIterate--Iterate-->tMysqlInput_2--main-->tLogRow
In tMysqlInput_2, I type this expression 'row1.query' in the query text field on tMysqlInput_2 for further extraction.
Scenario 2---tIterateToFlow:
tFileList--Iterate-->tIterateToFlow-->tLogRow
How can I get all file names from the specified directory and print them on console?
Use tIterateToFlow as the following image.
Regards,
Pedro
One Star

Re: Purpose of tFlowToIterate and tIterateToFlow

hello pedro, very nice your comment, I wonder if I can use the scenario-1 tFlowToIterate and within tMysqlInput use update and delete clauses, thanks
Moderator

Re: Purpose of tFlowToIterate and tIterateToFlow

Hi,
Do you want to iterate over each of the rows returned from the second query and use them to populate a command to be executed for each row in the first set?
Such as:tMysqlInput_1--main(row1)--tFlowToIterate--tMysqlInput_2--main--tLogRow
on tMysqlInput, set the query like:
"select * from tableName where id="+(Integer)globalMap.get("row1.id")
For your update and delete clauses, txxxrow component is preferred.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Purpose of tFlowToIterate and tIterateToFlow

@xdshi -do you know if it is possible to use the tFlowToIterate to loop through records and create a JSON string every X-Number of records?