Creating the DRL rules
Procedure
-
In the Outputs table, click in the
Rule column and then click the
[...] button of the
Paris schema.
-
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. -
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.
-
Click in the Rule column and then click
the [...] button of the "Paris" rule.
The rule template is opened in the rule editor in the workspace.
- In the "Paris" rule, add the code output.CityName = "Paris" to output Paris as the city name in the first output flow.
-
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.
- In the "Suresnes" rule, add the code output.CityName = "Suresnes" to output Suresnes as the city name in the second output flow.
-
In the design workspace, double-click each of the tLogRow components to define its properties.
For more information, see tLogRow.
-
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.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!