Rules Engine User Guide

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 18

TEMENOS T24

Rules Engine

User Guide

No part of this document may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of TEMENOS Holdings NV.

Copyright 2005 TEMENOS Holdings NV. All rights reserved.


Rules Engine

Table of Contents
Overview................................................................................................................................................ 3
Setup...................................................................................................................................................... 3
Rule Designer Main Screen............................................................................................................... 4
Rule Designer View............................................................................................................................ 5
Application Menu - Header Pane.................................................................................................... 5
Variables Pane............................................................................................................................... 6
Script Pane..................................................................................................................................... 6
Error and Description Pane............................................................................................................ 6
Definition of Rule Context.................................................................................................................. 7
Simple Context............................................................................................................................... 7
Complex Context............................................................................................................................ 8
Direct Complex Context.............................................................................................................. 8
Derived Complex Context........................................................................................................... 9
Deriving Similar to j-descriptor........................................................................................................ 9
Using Subroutine.......................................................................................................................... 10
Rule Designing..................................................................................................................................... 11
Adding Rule Context........................................................................................................................ 11
System Variables............................................................................................................................. 12
System Variables Explained......................................................................................................... 12
Rule Variables.................................................................................................................................. 13
Embedded Rule............................................................................................................................... 13
Rule Syntax and Functions.............................................................................................................. 14
Rule Structure.................................................................................................................................. 15
Validate Rule................................................................................................................................ 15
Saving the Rule to T24................................................................................................................. 16
Test Harness.................................................................................................................................... 16
Reporting.............................................................................................................................................. 17
EB.RULES....................................................................................................................................... 17
EB.RULES.VERSION...................................................................................................................... 17
EB.RULES.HIERARCHY................................................................................................................. 18

TEMENOS T24 User Guide


Page 2 of 18
Rules Engine

Overview
Rules Engine allows definition of complex business rules to support decision processing and scoring.
This needs to be generic so as to allow it to be deployed anywhere within T24 / ARC where a rules
based decision is required or where a score needs to be calculated.
The business rules language is procedural/imperative in style. It is helpful to think of it in terms of a
machine state consisting of a control part representing the instructions to be executed and a data part
consisting of the structure being manipulated by the instructions. Rules Engine has been designed to
be used by non-technical ‘power users’. Where previously a routine would need to be coded to make
a complex calculation or decision, The Rule Designer can be used by a business user to write a rule
expressing the logic required to make the correct decision or find the right score
Examples of where the Rules Engine can be used at the moment is in the CR Sales Opportunity
module, where it can be used to determine whether an opportunity is appropriate for a customer or
not and if so, what value/probability can be placed on that opportunity for a customer.
Another instance where a rule can be used is in process workflow, where a rule may determine the
correct status of a PW activity or process.
There are many places within T24 where a decision or score is made – along with Sales Opportunity
and process workflow, In future, the Rules Designer may be used in these places. This guide
describes the process of the business rules language and covers some simple usage through rule
composition

Setup
Rule Designer allows users to construct simple rules through an intuitive graphical interface and is
available as part of designers and Wizards option in T24 Tool box.

For Information on how to setup T24Toolbox refer Toolbox user guide.

TEMENOS T24 User Guide


Page 3 of 18
Rules Engine

Rule Designer Main Screen


The Rule Designer main screen consists of two tabs
1. Start Page – Gives access to rules recently worked with and help contents
2. Designer – The layout where the actual rule is designed.

Actions in start page are short cuts for creating a new rule, opening rule saved to T24 database or
opening rule saved to local disk database. It is advisable to login into a T24 server area before
starting to design rules.

TEMENOS T24 User Guide


Page 4 of 18
Rules Engine

Rule Designer View


The Rule Designer GUI consists of five main areas:
1. Application menu
2. Variable pane
3. Script pane
4. Error pane
5. Description Pane

Application Menu - Header Pane


The Header pane contains the name of the rule, a short description along with icons to execute
actions against a rule.

TEMENOS T24 User Guide


Page 5 of 18
Rules Engine

Variables Pane
The Variable Pane contains all ingredients for writing the rule.

Script Pane

The Script pane is where the business rule is defined. Script pane provides syntax coloring and
content assist functionality to aid definition of a business rule.

Error and Description Pane


The error and Description pane displays action/task specific errors messages and additional
information specific to business rule.

TEMENOS T24 User Guide


Page 6 of 18
Rules Engine

Definition of Rule Context

Creating rule context is the first step to be done before designing a business rule. Rule context are
defined(one time definition) in T24 application EB.CONTEXT. From a designer perspective, contexts
are T24 applications / field names indented to be used in rule definition.
For example, if the rule was based on whether customer has been at the bank for longer than a
specified period, or was resident in a particular country, the context would be based on T24 table
CUSTOMER. If the rule was based on whether an account had a balance higher than a particular
amount, or was a particular type of account, then the context would be based on ACCOUNT.

Simple Context

The simple EB.CONTEXT record has in its ID only. Field PRIMARY TABLE linked to Context
Variable in RULE DESIGNER can access any of the field in the table CUSTOMER for evaluation
of the rules.

TEMENOS T24 User Guide


Page 7 of 18
Rules Engine

Complex Context
Whenever the detail in a single table is insufficient to evaluate the rules, we need to have a complex
EB.CONTEXT. The id of any complex contexts should contain a delimiter ‘*’ – e.g.
CUSTOMER*COMPLEX. We have two types as below.

1) Direct Complex Context


2) Derived Complex Context

Direct Complex Context

To access data directly from more than one table, the tables that share a common ID can given in the
field PRIMARY TABLE and field LINKED TABLE linked to Context Variable in RULE DESIGNER
can access the field in the table for evaluation of the rules.

TEMENOS T24 User Guide


Page 8 of 18
Rules Engine

Derived Complex Context

When required information cannot directly get from the given tables, it needs to be derived. This can
be achieved in two ways as below.
1) Deriving Similar to j-descriptor
2) Using Subroutine

Deriving Similar to j-descriptor

Based on Primary key of a table, the desired value can be got in turn by linking to other tables whose
primary keys are obtained from the previous record.

DATA LABEL.1: New derived field which can be directly used in the RULES DESIGNER for
generating rules as any other field of the table.
SELECTION.PR.1.1: The value of the field is derived as similar to j-descriptor

The above image, Field DATA LABEL.1 (NEW.CUST.DERIVED) will hold the value of field
LABEL.DESCRIPTION.1 (DELIVERY.POINT) in the table DEPT.ACCT.OFFICER. System will use
the value in the field ACCOUNT.OFFICER from the table CUSTOMER and read the corresponding
record in DEPT.ACCT.OFFICER to fetch the value of DELIVERY.POINT

TEMENOS T24 User Guide


Page 9 of 18
Rules Engine

Using Subroutine

Complicated values can be very well achieved by writing a subroutine which returns the desired value.

DATA ROUTINE.1: Where the Routine attached


DATA.ARG.TAB.1.1: Table name where the argument is a field.
DATA ARGUMENT.1.1: Field name of the table whose value is passed as an argument
MULTI.VALUE.ACT.1: Returned argument is multi – valued action to perform on it.

TEMENOS T24 User Guide


Page 10 of 18
Rules Engine

Rule Designing
Adding Rule Context
To add /include rule context,
1. Expand the “Contexts” list from the variable pane
2. Double click on the “…” element of the list

The below window appears

Choose the required context required for the business rule and select OK. When a context is added
to a rule, all fields available in T24 application context would be displayed under the context screen.
The required context can be added or removed depending on the business rule’s requirement.

TEMENOS T24 User Guide


Page 11 of 18
Rules Engine

System Variables

The System variables hold information representing the system state during the Rule Evaluation and
can be used when defining a business rule. However, only the special system variables (i.e variables
that starts with RULE… e.g RULE.SCORE ) are assignable. All other system variables can only be
used as a reference. For example a business rule cannot assign value to system variable TODAY. (i.e
TODAY = 20090101 is not a valid assignment )

System Variables Explained

Variable name Content


TODAY Today's date
OPERATING.COMPANY Current Company where the user has Logged in
CURRENT.OPERATOR Current logged user
LOCAL.COUNTRY.OF.BANK Bank’s local country
SECOND.WORKING.DAY The date of the next working day
RULE.STATUS Used within the rule to indicate to the calling process if the
test passed or failed
RULE.MESSAGE Used within the rule to return a narrative indicating to the
calling process why the rule failed.
RULE.SCORE Used within the rule to return a score to the calling process
in those case where the rule is calculating a score
RULE.ERROR Used within the rule to return a string id, for lookup in the
EB.ERROR table, used for internationalisation of
messages

TEMENOS T24 User Guide


Page 12 of 18
Rules Engine

Rule Variables
Rule variables are virtual fields that are used solely for that specific rule. The below example uses rule
variable TOTAL.BALANCE which at run time contains the total account balance.

Embedded Rule
It is possible to nest (embed) an existing rule with a new rule. However, it should be noted that is a
context used in embedded rules should be the same.

In the above example, both the rules (check Sector and Check Industry) uses the same context
CUSTOMER. These rules can be embedded when defining a new rule as below.

In the above embedded rule example, CustomerCheckIndustry and


CustomerCheckSector are embedded and their score and status are being accessed.

TEMENOS T24 User Guide


Page 13 of 18
Rules Engine

Rule Syntax and Functions

Following functions can be used when defining a business rule. Functions can also be selected from
the variable pane and such a selection would auto script the function selected in scripting pane.

The following operators will be supported. They are listed in precedence order, with the most tightly
binding operators listed first.

Description Operator Example


Logical negation not not(i eq 10 or i lt 7)
Unary sign operator - RULE.SCORE = -10
Multiplying operators * / RULE.SCORE = i * j / k
Binary adding operators + - RULE.SCORE = I + j – k
Comparison operators
Equals eq s eq "fred" or i eq 10
Not equals ne s ne "fred" and i ne 10
Less than (numbers only) lt i lt 10
Less than or equals (numbers only) le i le 10
Greater than (numbers only) gt i gt 10
Greater than or equals (numbers only) ge i ge 10
In range (numbers only) rg i rg 10 20
Not in range (numbers only) nr i nr 10 20
Like (strings only) lk S lk "...A..."
Unlike (strings only) ul S nl "...A..."
Boolean and and i lt 10 and j rg 10 20
Boolean or or i lt 10 or j nr 10 20

TEMENOS T24 User Guide


Page 14 of 18
Rules Engine

Rule Structure
It is possible to define simple and complex rules and the typical structure of a business rule may be
seen below.

Validate Rule

On selecting icon Validate Rule or Key F8 , Active rule is validated and below message is
displayed.

This confirms that a valid rule has been written – the syntax is correct, and the rule can be evaluated.
If there are problems with the validation, these will be shown in the Error pane, which will indicate the
first issue with the rule to be corrected.

TEMENOS T24 User Guide


Page 15 of 18
Rules Engine

Saving the Rule to T24

On clicking the icon save Rule to T24 a save dialog would appear. A valid name and description
needs to be updated. A confirmation message should appear (as below)

Test Harness
The Test Harness is designed to enable the user to test their rule and ensure that it is giving the
expected results, before putting it to use. The user is able to enter sample data without accessing
T24 data, to see the output that would be generated if this data was supplied from T24 through the
contexts.
The results for the Valid Rule will be displayed in the Test Harness. On Pressing icon Run Test
Harness or key F5 Test Harness window is displayed.

TEMENOS T24 User Guide


Page 16 of 18
Rules Engine

Reporting
EB.RULES
EB.RULES is a system maintained file which holds the versions of each rules created in the Rules
GUI. The key to this file being a unique basic description of the underlying rule each time the rule
changed and saved the version/date is written to this file.

EB.RULES.VERSION
When a rule is saved in the GUI a record will be written to the file EB.RULES.VERSION, if the rule is
edited on a different day to the original rule then a new rule record will be written with the current date
as the new version number. This is so that versioning can be applied to rules, and specific versions of
rules can be called where appropriate.
The ARC / T24 output which the rules engine produces upon evaluation of a business rule.
EB.RULES.VERSION shows the rule structure in XML format.

TEMENOS T24 User Guide


Page 17 of 18
Rules Engine

EB.RULES.HIERARCHY
EB.RULES.HIERARCHY when a rule is saved a record will also be written containing one field
which will contain a chain of all the rules nested rule keys and the nested rules nested rules.
This is again necessary for rules versioning, where the user can work out how the changing of one
rule may impact the processing of other rules. For example, if a rule is updated to add a new context,
then all rules which use that rule may also need to be updated, to ensure they can still provide the
necessary data to run that rule

TEMENOS T24 User Guide


Page 18 of 18

You might also like