Implementing validation rules - 7.3

Talend Data Mapper Functions Reference Guide

Version
7.3
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2023-01-05

Use a CondValidateReport function to implement validation rules on a hardware request form.

Before you begin

Create a hardware_request.csv file in your local machine. Populate your CSV file as such:
Name, Location, Department, HW_ID

Procedure

  1. In Talend Data Mapper, open Hierarchical Mapper > Structures.
  2. Import hardware_request.csv as a Structure. This creates a new hardware_request Structure.
  3. Right-click Hierarchical Mapper > Maps and select New > Map.
  4. Select Standard Map and create a new map called hardware-request.
  5. Open the newly created hardware-request Map and drag the hardware_request Structure to both the Input and Output tables.
  6. Map each row from the Input to the corresponding row in the Output table.
  7. Select the Department row from the Output table and open the Validate tab.
  8. From the Functions tab, select CondValidateReport and drop it in the Validate tab.
  9. Double-click on CondValidateReport and enter Invalid Department in the Message field.
  10. In the Condition section, drag-and-drop the Equal function.
  11. In the First Value section, drag-and-drop the Constant function and enter Sales in its Value field.
  12. In the Second Value section, drag-and-drop the Department row from the Output table.
  13. Open the hardware_request.csv file to modify the entry. Replace the values with:
    John, Dublin, Sales, 12
    Harrison, Denver, Sales, 14
  14. Select Show Document > Import Document from File and select the hardware_request.csv file you just edited.
  15. Click Test Run to see the results:
  16. Repeat step 13. Modify Sales to Support.
  17. Repeat steps 14-15. See that an error is displayed after clicking Test Run.