Run if connection settings - Cloud - 8.0

Talend Studio User Guide

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-29

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.

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.