Applying the validation rule and viewing the Job execution result - 8.0

Data Integration Job Examples

Version
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2024-02-06

Procedure

  1. Click the Validation Rules tab in the Component view of tMysqlOutput.
    Screenshot of the component validation rules.
  2. Select the Use an existing validation rule check box to apply the validation rule to the component.
  3. In the Validation Rule Type list, select Repository and click the three-dot button to select the validation rule from the Repository Content window.
  4. Right-click tMysqlOutput, select Row > Rejects in the menu and drag to tLogRow to create a reject link between the two components.

    If you have enabled the Reject link option for this validation rule you can retrieve the rejected data to the reject flow.

  5. Double-click the tJava component to display its Basic settings.
    Screenshot of the component basic settings.
  6. In the Code field, type in the code that will display the number of updated, inserted, and rejected lines processed:
    System.out.println("Updates: "+((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_UPDATED"))+"\nInserts:
    "+((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_INSERTED"))+"\nRejects:
    "+((Integer)globalMap.get("tLogRow_1_NB_LINE")));
  7. Save your Job and press F6 to run it.
    Screenshot of the console after successfully running the Job.

Results

Valid data is inserted or updated in the database table and the console displays the rows rejected by the validation rule, along with the number of updates, inserts and rejects processed in the Job.