About this task
In the Basic settings view of a Run if connection, you can set the condition to the subJob in Java.
You can use variables in your condition. Pressing Ctrl+Space allows you to access all global and context variables. For more information, see Using variables in a Job or Route.
When adding a comment after the condition, be sure to enclose it between /* and */ even if it is a single-line comment.
In the following example, a message is triggered if the input file contains 0 rows of data.
- Create a Job and drop three components to the design workspace: a tFileInputDelimited, a tLogRow, and a tMsgBox.
Connect the components as follows:
Right-click the tFileInputDelimited component, select Row > Main from the contextual menu, and click the tLogRow component.
Right-click the tFileInputDelimited component, select Trigger > Run if from the contextual menu, and click the tMsgBox component.
- Configure the tFileInputDelimited component so that it reads a file that contains no data rows.
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
- 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.
- Save and run the Job. You should see the message you defined in the tMsgBox component.