Trigger connections define the processing sequence, so no data is handled through these connections.
The connection in use will create a dependency between Jobs or subJobs which therefore will be triggered one after the other according to the trigger nature.
Trigger connections fall into two
categories:
- subJob triggers: On
Subjob Ok, On Subjob Error and Run if,
- component triggers: On
Component Ok, On Component Error and Run if.
OnSubjobOK: This connection is used to trigger the next subJob on the condition that the main subJob completed without error. This connection is to be used only from the start component of a subJob.
These
connections are used to orchestrate the subJobs forming the Job or to easily
troubleshoot and handle unexpected errors.
OnSubjobError:
This connection is used to trigger the next subJob in case the first (main)
subJob do not complete correctly. This "on error" subJob helps
flagging the bottleneck or handle the error if possible.
OnComponentOK and OnComponentError are component triggers. They can
be used with any source component on the subJob.
OnComponentOK will
only trigger the target component once the execution of the source component is
complete without error. Its main use could be to trigger a notification subJob
for example.
OnComponentError will
trigger the subJob or component as soon as an error is encountered in the
primary Job.
The main
difference between OnSubjobOK and OnComponentOK lies in the execution order of the
linked subJob.
·
With OnSubjobOK, the linked
subJob starts only when the previous subJob completely finishes.
·
With OnComponentOK, the linked
subJob starts when the previous component finishes.
The execution
order of the subJobs linked by OnComponentOK is
within the execution cycle of the previous subJob.
Run if connection settings
About this task
In
the Basic settings view of a Run
if connection, you can set the
condition to the subJob in Java.
In the following example, a message is triggered if the input file contains 0 rows of data.
Procedure
1.
Create
a Job and drop three components to the design workspace: a tFileInputDelimited,
a tLogRow, and a tMsgBox.
2.
Connect
the components as follows:
o
Right-click the tFileInputDelimited component, select Row > Main from
the contextual menu, and click the tLogRow component.
o
Right-click the tFileInputDelimited component, select Trigger > Run if from
the contextual menu, and click the tMsgBox component.
3.
Configure
the tFileInputDelimited component so that it reads a file that
contains no data rows.
4.
Select
the Run if connection between the tFileInputDelimited component
and the tMsgBox component, and click the Component view.
In the Condition field on the Basic settings tab,
pressing Ctrl+Space to access the variable list, and select
the NB_LINE variable
of the tFileInputDelimited component. Edit the condition as
follows:
((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE"))==0
5.
Go
to the Component view of the tMsgBox component,
and enter a message, "No data is read from the file" for example, in
the Message field.
6.
Save
and run the Job. You should see the message you defined in the tMsgBox component.