Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Order of components execution (Main, If, OnComponentOk, OnSubJobOK, SubJob)

Hi,

Where I can to find the official page about the execution order of components?

I´m reading a job, it Works fine.

It has a Main and others 'branches', then I don't understand which component runs first, second, third...

 

Example: Which component runs after the tLibraryLoad_commonscodec: tLibraryLoad_bcpg or tMMsqClose_1?

if tLibraryLoad_bcpg then: which component runs after the tLibraryLoad_bcpg: tFileList_1 or tMMsqClose_1?

 

 

 

Other example: After tJava_4 runs... then tJava_3 runs or tFileList_1 iterates the next file? 

0683p000009M8sF.png

And the last example: After tJavaRow runs... then tFlowToIterate runs or the tFileInputDelimited in the below subJob? 

 After tFileOutputDelimited runs... then tFileInputExcel runs or the tFileInputDelimited in the below subJob?

0683p000009M8ln.png

 

If you response to me thanks about the examples, thanks. 

But it thanks you more if you says me where is the explanation page about all order of execution cases.

 

Labels (3)
2 Replies
PhilHibbs
Creator II
Creator II

Good question! It looks to me like the documentation does not explicitly state the order of execution.

 

As to your specific question of the tJavaRow and tFlowToIterate vs the If link from the tFileInputDelimited, I don't know. I have, however, looked into the relative order of the trigger link types (OnSubjobOk, OnComponentOk, and If). Whilst not exactly the same as your question, I think it's worth sharing my results.

 

From my experiments, these are the rules:

 

OnSubjobOK: These links trigger last, in the order that they are aset in the order configuration dialog.

 

OnComponentOk & If: These are complicated. You cannot tell from the job design which one will execute first. They appear to be executed in the order that they are created, but changing the order can move them around.

For example, I added an OnComponentOK and an If to the same component, and they executed in the order that they were created. I delete them and recreate them in the opposite order, and they run in that reversed order.

With the If link running first, I add a second If link. It runs last - so the first If link runs, then the OnComponentOk, then the second If link.

If I then change the order of the If links so that the first one runs last, then it gets moved to after the second If link. So the order is now OnComponentOk, then the second added If link, then the first added If link (because it has been moved to after).

If you open the "Modify If links order" dialog and move the If link that is now first to the end, then move it back to the begining, and then close the dialog, you might think that nothing will change. However, this will move it to before the OnComponentOk that was the first to execute. The second If link will remain at the end of the execution order.

 

I think that this is why they didn't document it! It is complicated, and may be subject to change in future implementations.

 

So the OnComponentOk triggers will run in their respective order, the If triggers will run in their respective order, but they may well be interleaved with each other based on the original creation order and the re-ordering operations peformed on them.

 

The only safe way is to to make it ecplicitly clearis not to mix OnComponentOk and If links! Make them all If links, set the order yourself in the "Modify If links order" dialog, and set the unconditional ones to a condition of true.

 

Update!

Behaviour does indeed differ with different Talend versions. The above conclusion - that OnComponentOk and If links are interleaved - only applies to v6 (I tested on v6.3, I don't know about other v6.x versions). v7.1 appears to always execute If links first, then OnComponentOk links. I don't know if this behaviour is reliable and documented though, so exploit at your own risk!

PhilHibbs
Creator II
Creator II

I think that the answer to your question about the Iterate and the If link is that the Iterate will run first. The If link works like an OnComponentOk, and the component is not OK until it has finished sending its flow output, and that flow is being converted to an Iterate, so it has to finish iterating before the If link can happen.

 

After each iteration of the tJava_4, the OnComponentOk will trigger tJava_3 before the next tJava_4 iteration. Because tJava_3 is a separate subjob, its OnSubjobOk will then trigger, again before the next tjava_4. If the link from tJava_4 had been OnSubjobOK then it would happen once at the end of all the iterations of tJava_4.