Creating the DRL rules - 7.0

Business rules

author
Talend Documentation Team
EnrichVersion
7.0
EnrichProdName
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 Real-Time Big Data Platform
task
Data Governance > Third-party systems > Processing components (Integration) > Business rules components
Data Quality and Preparation > Third-party systems > Processing components (Integration) > Business rules components
Design and Development > Third-party systems > Processing components (Integration) > Business rules components
EnrichPlatform
Talend Studio

Procedure

  1. In the Outputs table, click in the Rule column and then click the [...] button of the Paris schema.
  2. In the open dialog box, select one of the options as the following:

    Select

    To...

    Edit Rules

    open the rule in the rule editor in the workspace.

    Create a rule with guide

    open a dialog box where you can define a rule in the rule template.

    select a rule from repository

    select a predefined rule from the rule template created and stored in the Repository tree view.

    In this example, select the Create a rule with guide option.
  3. In the open dialog box, use the Drools syntax to set the condition of the "Paris" rule as the following: zipCode matches "75\\d{3}", and then click OK.
    The new "Paris" rule is generated and displayed in the Rule column. This rule retrieves from the Paris schema all zip codes that start with 75 and the three figures that follow.
  4. Click in the Rule column and then click the three-dot button of the "Paris" rule.
    The rule template is opened in the rule editor in the workspace.
  5. In the "Paris" rule, add the code output.CityName = "Paris" to output Paris as the city name in the first output flow.
  6. Repeat the above steps to create a "Suresnes" rule and set its condition as the following zipCode == "92150".
    The new rule is displayed in the Rule column. This rule retrieves from the Suresnes schema all zip codes that are equal to 92150.
  7. In the "Suresnes" rule, add the code output.CityName = "Suresnes" to output Suresnes as the city name in the second output flow.
  8. In the design workspace, double-click each of the tLogRow components to define its properties.
    For more information, see tLogRow.
  9. Save your Job and press F6 to execute it.
    The Run console displays two output flows with zip codes and city names.
    In the first output flow, the "Paris" rule retrieves all zip codes that start with 75 and writes the city name as Paris.
    In the second output flow, the "Suresnes" rule retrieves all zip codes that are equal to 92150 and writes the city name as Suresnes.