Question

I have a talend mapping which needs to be executed based on a ID. I want to pass the ID as a parameter. The mapping should execute for one ID at an time. I want to loop the execution for each ID one after the other. This can be achieved in SSIS using the For Loop Container. Can anyone help me finding out the equivalent for the same in Talend Open Studio.

Thanks in advance.

Was it helpful?

Solution 2

You can use the analogue tForeach component, and set the ID's values inside it. After that, you should connect the iterate output and reference the current value with the variable ((String)globalMap.get("tForeach_1_CURRENT_VALUE")) where the tForeach_1 is the name of your tForeach component.

enter image description here

enter image description here

And set the Query to something like:

"select id, name  from employee
where id="+((String)globalMap.get("tForeach_1_CURRENT_VALUE"))

OTHER TIPS

If you take just the Id part of your input and then link that to the main part of your current job with an Iterate link via a tFlowToIterate component it should automatically do this. You can access the value from the GlobalMap using something along the lines of ((String) GlobalMap.get("row1.Id")).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top