Skip to main content Skip to complementary content

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.

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.

Information noteWarning: 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.

Basic settings view of the connection.

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:
    • 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.
  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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!