One Star

How to iterate (ForEach) over MysqlInput rows, and MysqlRow

I'm trying to iterate over the input given by a MysqlInput component, but just can't get the foreach component working.
The documentation just doesn't help me at all.
The job looks like:
tMysqlInput_1 -- iterate -- tForeach_1 -- iterate -- tMysqlRow_1 -- row1 -- tLogRow_1
The tMysqlInput contains a simple query giving me 12 rows with 3 columns.
Colums are defined as:
| Key (string) | DateTime (Date) | Description (String). |
I just have no idea what values I should enter at the tForeach_1 component and MysqlRow components to have them iterate over the rows, and do a subquery based on the DateTime field in the iterated row.
I tried to add "((String)globalMap.get("tMysqlInput_1_QUERY"))" as the Value in the Values basic settings of the tForeach_1 component, but nothing seems to happen.
Furthermore, how to do the subquery (where clause) with the input from the tForeach DateTime field?
2 REPLIES
One Star

Re: How to iterate (ForEach) over MysqlInput rows, and MysqlRow

Hi ,
I'm not very clear on what you are trying to achieve.
I tried to add "((String)globalMap.get("tMysqlInput_1_QUERY"))" as the Value in the Values basic settings of the tForeach_1 component, but nothing seems to happen.
Furthermore, how to do the subquery (where clause) with the input from the tForeach DateTime field?

On the above lines - which globalMap variables you are trying to get? Where you have set those variables?
While doing iterations - you would need to set required globalMap variables and you can use those variables as parameters in your successive SQL subqueries.
One Star

Re: How to iterate (ForEach) over MysqlInput rows, and MysqlRow

As far as I know, the tMysqlInput component outputs the flow to the QUERY variable (the tMysqlInput_1_QUERY global var).
The iterate component tForEach should now iterate over the rows, but that doesn't happen.
I see that the query contains 12 rows. The tMysqlInpt component tells me '12 execs finished', but the Foreach output only reports 1 exec finished: I would expect 12 execs fininshed too!
In other words: I can't find the proper example/documentation how to iterate over a mysql query, and do a subquery on each row...