Creating business rules - 6.3

Talend Administration Center User Guide

English (United States)
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend Real-Time Big Data Platform
Talend Administration Center
Administration and Monitoring

These sections explain in detail how to use the Drools page to define business rules. However, keep in mind that you must deploy the rule before being able to use it in any production environment. For further information, see Building and deploying business rules.

How to add a rule

From Talend Administration Center, you can create rules using WHEN-THEN statements with conditions that are logical groupings of logical operators. Based on data that comes from a variety of sources and departments, the business expert can then define actions, to be executed if the rule condition evaluates to true.

In the following example, you will create a Guided Rule named CheckYoungAge that will be used to trigger loan agreement decisions based on the age of the people who apply for bank loans.

Prerequisites: You have already defined an organizational unit, a repository and a project in Drools web application. For further information see Steps to follow when using Drools, and for detail information about using Drools, check Drools Workbench.

To create a business rule:

  1. From the Drools page, click Authoring and select Project Authoring.

  2. From the New Items list, select Guided Rule.

    The [Create new Guided Rule] dialog box opens.

  3. In the Guided Rule field, enter a name for the new rule, CheckYoungAge in this example.

  4. From the Package list, select the package in which you want to create the rule.

    The package list will include only the packages to which you have access.

  5. Select the Use Domain Specific Language (DSL) check box if you want to provide access to a list of "DSL Sentences" from which you can choose a condition to add to the rule.

  6. Click OK to complete the rule creation and close the dialog box.

    The new rule is added under the Guided Rules folder in the left panel and is opened in the rule editor in the workspace.

At any time, you can view a list of rules you have created by either selecting your category from the Browse panel, or selecting your package from the Knowledge Bases panel, and open a rule by clicking the corresponding Open button.

How to define a rule

Upon creating a business rule, you need to define the conditions and actions of your new rule in the WHEN and THEN statements.

Suppose that you want to approve or disapprove a loan according to strict rules regarding the age of the borrower. The defined statement in the below example says that if the age of the person who wants to get a loan meets the specified conditions (younger than 20, or older than 70) then the loan will not be approved.

To define a condition in the WHEN statement, do the following:

  1. Click the green [ + ] button next to WHEN to open the [Add a condition to the rule] dialog box.

  2. Select a class from the list, LoanSimulator in this example, and then click OK.

  3. Click There is a LoanSimulator to open a dialog box and set a variable name.

  4. In the Variable name field, enter a variable name, customer in this example, and click Set. The variable name is written in the WHEN statement.

  5. Click There is a LoanSimulator [customer] to open the [Modify constraints] dialog box again.

  6. From the Add a restriction on a field list, select age to add an age field to the WHEN statement.

  7. From the logical operators list, select a logical operator, less than in this example, and then click the pencil icon to open the [Field value] dialog box.

  8. Click the New formula button to add a value field next the logical operator, and enter 20 in the field.