Question

If I use a 'Run if' condition, it can not work as an 'Iterate' as well?

I have a variable_X that allows many values (defined in a 'tFlowToIterate' component'). Than, depending on the the value of a variable_Y, I want to pass all the values of the variable_X to another Job (one of 4 available jobs). So, I want to use a 'Run If' condition before each Job, but I want to iterate the values of the variable_X through the chosen job...

How can I do this?

Was it helpful?

Solution

I'm a bit confused. You want to use the variable Y to choose which subjob to calls, but you then want to pass to that subjob a variable X that flows from a tFlowtoIterate (thus changing at each iteration)?

As far I know, I'm afraid it's not possible. You can throw different RunIf signals from a Iterate signal with a little trick, but you can't Iterate through a child job. The child job would be called at each iteration with the single value of X, nor the collection. If you need that, I'm afraid you have to change your design a bit (for ex. concatenate the possible value of X on a single String, explode it inside the child job and loop locally)

If you want to trig multiple signals from a Iterate symbol you can do the undocumented "component-buffer" trick. It's not something that Talend team is probably happy to know, but it works. The idea is to use a dummy component that proxies the Iterate signal.

                                                         /--->RunIf--->[stuff1]
                                                        /
                                                       /
tRowGenerator---row--->tFlowToIterate---Iterate--->tWarn--->RunIf----->[stuff2]
                                                       \
                                                        \
                                                         \--->RunIf--->[stuff3]

The tWarn (you can use to print a verbose DEBUG, for ex.) will act as a proxy. So, the RunIf will be evaluated at each iteration. The "stuff" can be a subjob but it will get the current value of X, not the entire collection.

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