Run if connection settings - 7.3

Talend Open Studio User Guide

Version
7.3
Language
English
Product
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Module
Talend Studio
Content
Design and Development
Last publication date
2023-10-11
Available in...

Open Studio for Big Data

Open Studio for Data Integration

Open Studio for ESB

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.

Warning:

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.

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.