[resolved] Limiting tLoop

One Star

[resolved] Limiting tLoop

Hi,
I am confused about the way tLoop works. I want to loop the one component that it is linked to, but instead it loops the rest of the job after tLoop. Example:



How do I limit its looping to the first tJava and NOT loop on the second one? (tJava's are examples, the real job is more complicated)
Thanks.
Employee

Re: [resolved] Limiting tLoop

Hi,
On the component tLoop, use a OnSubjobOK trigger and link it to the HappenOnce. 
Regards
One Star

Re: [resolved] Limiting tLoop

That makes tLoop loop within itself 9 times and execute "print_loop_#" once. My goal is to loop on "print_loop_#" 9 times, then stop looping and execute the rest of the job once.
One Star

Re: [resolved] Limiting tLoop

Hi neofit,
mgainho had replied correctly your question
please look below screenshot 
Seventeen Stars

Re: [resolved] Limiting tLoop

Hi neofit,
if you need to stop the tLoop based on a condition you can check the data in the tJava (you already have) and simply call
break;

or
continue;

(if you want to skip over a value).
Keep in mid the whole magic of the tLoop is done by a while or for loop ;-)
One Star

Re: [resolved] Limiting tLoop

mgainho had replied correctly your question

Hello,
Technically I did what was advised and replaced the Iterate link with an OnSubjobOK and got what I said Smiley Happy :


Now, if I do it the way it is on your screenshot, with the two paths, is there a guarantee that the Iterate link and all the 1, 2 or 10 components that follow will all be performed before the Job starts on the OnsubjobOK link? And if so, is this order of precedence documented somewhere?
Here is a simplified example of what I am trying to do:


10 tables, wisely named tbl1 to tbl10, are to be read into a temporary table, then some processing is to be done, one by one. When all 10 are processed I need to read the resulting temporary table and extract it into a file.
So is there a guarantee that all the components after the Iterate link will all be processed before the OnSubjOK is done? I know of some particular behaviour, if for example I throw some components onto the canvas without linking each of them, theye will be executed in the order of creation. Won't the links going out of the tLoop component be processed in the order of creation too?
Seventeen Stars

Re: [resolved] Limiting tLoop

because if it doesn't , it's a bug Smiley Happy
more seriously, each blue part are subjob. In your example tloop component + 4 Db components are in the same blue part (subjob).
For my point of view, I'll do my iteration in a child Job :

tLoop ---- iterate ---- tRunJob

by that what you can do some unit test on data (read, insert, update) without be aware about iteration or trigger action.
regards
One Star

Re: [resolved] Limiting tLoop

because if it doesn't , it's a bug Smiley Happy
more seriously, each blue part are subjob. In your example tloop component + 4 Db components are in the same blue part (subjob).

Oh <where is that emoticon with a lightbulb lighting up>.
What I was worried about is the following. Let's say each DB operation takes 1 minute. I was worried that as soon as the tLoop finishes its last loop and gives control to the 1st Iterate component ('Read current table'), that it is free to so give control to the other link originiating from it on that very second withouyt waiting for the rest of the processing chain, since the component itself is done. But hey, the link is called "OnSubobjOK", not "OnComponentOK", so it will only gain control when the whole blue thingy ends, oops.
Thanks.