Rules Engine
Rules Engine
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.
Table of Contents
Overview.................................................................................................................................................. 4
Setup ....................................................................................................................................................... 4
Rule Designer Main Screen ................................................................................................................. 6
Rules Designer Script Screen .......................................................................................................... 7
Header Pane .................................................................................................................................... 8
Application Menu: ................................................................................................................................ 8
Icons ................................................................................................................................................. 8
Variables Pane ..................................................................................................................................... 9
Contexts: .............................................................................................................................................. 9
Creating a Context ........................................................................................................................... 9
Simple Context ............................................................................................................................... 10
Complex Context ............................................................................................................................ 11
Direct Complex Context ................................................................................................................. 11
Derived Complex Context .............................................................................................................. 12
Deriving Similar to j-descriptor .................................................................................................... 12
Using Subroutine ........................................................................................................................ 13
Sample Routines Examples ....................................................................................................... 14
Adding Context ............................................................................................................................... 14
Enter Context Name: ...................................................................................................................... 15
Remove Context............................................................................................................................. 15
Insert Context Variable to Text ....................................................................................................... 15
System Variables: .............................................................................................................................. 16
System Variables Explained .......................................................................................................... 16
Insert System Variable to Text ....................................................................................................... 17
Rule Variables .................................................................................................................................... 18
Add Rule Variable .......................................................................................................................... 18
Remove Rule Variable ................................................................................................................... 19
Insert Rule Variable to Text ............................................................................................................ 20
Embedded Rule ................................................................................................................................. 20
Add Embedded Rule ...................................................................................................................... 21
Remove Embedded Rule ............................................................................................................... 22
Insert Embedded Rule to Text ....................................................................................................... 23
Functions ........................................................................................................................................... 24
Operators ....................................................................................................................................... 25
Insert Function to Text.................................................................................................................... 26
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. To open
rule designer follow the process below:
Script Pane
Application Menu
Variables Pane
Error Pane
Header Pane
The Header pane contains the name of the rule, a short description.
Application Menu:
Menu Pane includes File, Edit, Rule, Tools, and Help.
Icons
New Rule opens a blank page to create a new rule
Open Rule allows the user to open an existing saved rule on the local disk drive.
Open Rule from T24 it allows opening saved rule from T24
Save rule to the local disk drive
Save rule to T24
Print Rule
Comment on selected line
Uncomment the Selected line
Increase Indenting
Decrease Indenting
Edit Rule Description allows editing the Description of a saved rule.
Validate rule (Short key F8), allows validating rule.
Run Test Harness GUI (Short key F5) to check the functionality of Valid Rule.
Variables Pane
The Variable Pane contains all ingredients for writing the rule.
The CONTEXT and system variables are classified in Alpha character, Numeric, Date
Contexts:
All rules have to take place within a specific CONTEXT the context details the data that is being
tested by the rule to give a true/false answer, a score and/or a message.
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 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.
Creating a Context
In order to evaluate the rule we need pass context data. Within each of the calling process we will
only need to define the rule we wish to access and the source of ID to the T24 / ARC business object
(main application) with which the interface can build the context data.
The application EB.CONTEXT allows the definitions of contexts for use within rules. A single context
can link together multiple tables, as long as they share the same ids – for example, CUSTOMER,
CUSTOMER.SECURITY and CUSTOMER.CHARGE. In addition, derived contexts can be added to
an EB.CONTEXT. If we need to find additional data about a table which is not directly held on the
table – for example, the average balance of an account for that month, or the geographic block of a
customer’s residence
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.
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
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.
Derived EB.CONTEXT
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
Using Subroutine
Complicated values can be very well achieved by writing a subroutine which returns the desired value.
About Routines
For every routine only one Data Argument can be passed or written
Adding Context
1. Expand the “Contexts” list from the variable pane
2. Double click on the “…” element of the list
Through either of the two options, a window appears (See picture below)
Adding Context
The user may either enter the name of the context or perform a simple search from the defined
Contexts.
Remove Context
There are two ways to perform this step:
Option 1:
1. Expand the “Contexts” list from the Variables pane
2. Select the context to be deleted
3. Click the “Delete” button
Option 2:
1. Expand the “Contexts” list from the Variables pane
2. Right click on the context to be deleted
3. A pop-up menu is shown.
4. Select “Remove Item”
Note: a context can only be removed from a rule if it is not being used in the rule anywhere.
Option 1:
1. Simply type “CUSTOMER>SALARY” to the script
Option 2:
1. Expand the “Contexts” list from the Variables pane
2. Expand the “CUSTOMER” context
3. Double click on the “CUSTOMER>SALARY” element of the list.
Option 3:
1. Through predictive text. As the user start typing “CUSTOMER>SALARY”, a list will appear
with all the currently defined variables that start with the specific characters.
“CUSTOMER>SALARY” will be one of these variables. The user can therefore select the
variable from the list before completing typing the text.
Option 4:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
3. Select “Context variable”
4. A list appears with all the context variables. Select “CUSTOMER>SALARY”.
Option 5:
1. Press Ctrl+Shift+C
A list appears with all the context variables. Select “CUSTOMER>SALARY”.
System Variables:
The System elements hold information representing the system state during the Rule Evaluation
RULE.ERROR Used within the rule to return a string id, for lookup in the
EB.ERROR table, used for internationalisation of messages
System Variables
Option 1:
1. Simply type “RULE.SCORE” to the script
Option 2:
1. Expand the “System Variables” list from the Variables pane
2. Double click on the “RULE.SCORE” element of the list.
Option 3:
1. Through predictive text. As the user starts typing “RULE.SCORE”, a list will appear with all the
currently defined variables that start with the specific characters. “RULE.SCORE” will be one of
these variables. The user can therefore select the variable from the list before completing typing
the text.
Option 4:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
Option 5:
1. Press Ctrl+Shift+S
2. A list appears with all the system variables. Select “RULE.SCORE”.
Rule Variables
Rule variables are variable names that are used solely for that specific rule.
Option 2:
1. Expand the “Rule Variables” list from the Variables pane
2. Double click on the “…” element of the list
The user must enter the name and enter the description fields.
Option 1:
1. Expand the “Rule Variables” list from the Variables pane
2. Select the variable to be deleted
3. Click the “Delete” button
Option 2:
1. Expand the “Rule Variables” list from the Variables pane
2. Right click on the variable to be deleted
3. A pop-up menu is shown.
4. Select “Remove Item”
Option 1:
1. Simply type “VARIABLE.A” to the script
Option 2:
1. Expand the “Rule Variables” list from the Variables pane
2. Double click on the “VARIABLE.A” element of the list.
Option 3:
1. through predictive text. As the user starts typing “VARIABLE.A”, a list will appear with all the
currently defined variables that start with the specific characters. “VARIABLE.A” will be one of
these variables. The user can therefore select the variable from the list before completing typing
the text.
Option 4:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
3. Select “Rule variable”
4. A list appears with all the context variables. Select “VARIABLE.A”.
Option 5:
1. Press Ctrl+Shift+R
A list appears with all the system variables. Select “VARIABLE.A”.
Embedded Rule
Stores list of Nested Rules and can be used in current rule evaluation. . Any rule that has been
previously written can be used in any other rule – however, if an ‘embedded rule’ uses a new context,
then the master rule must also have that context – for example, my rule
‘CUSTOMER.CREDIT.RATING’ may use both CUSTOMER and ACCOUNT as contexts. If I have
another rule called MORTGAGE.RISK.REVIEW based on the MG.MORTGAGE context, but which
also uses the CUSTOMER.CREDIT.RATNG rule, then the MORTGAGE.RISK.REVIEW rule will need
to have the contexts CUSTOMER and ACCOUNT as well, in order to have all the information
necessary to resolve the rule.
Option 2:
1. Expand the “Embedded Rules” list from the Variables pane
2. Double click on the “…” element of the list
Through either of the two options, a window appears (see picture below)
The user may either enter the name of the rule or perform a simple search.
NOTE: If no text is entered, the search button will return all the available rules.
Option 2:
1. Expand the “Embedded Rules” list from the Variables pane
2. Right click on the rule to be deleted
3. A pop-up menu is shown.
4. Select “Remove Item”
Option 1:
1. Simply type “RULE.A” to the script
Option 2:
1. Expand the “Embedded Rules” list from the Variables pane
2. Double click on the “RULE.A” element of the list.
Option 3:
As the user starts typing “RULE.A”, a list will appear with all the currently defined variables that
start with the specific characters. “RULE.A” will be one of these variables. The user can therefore
select the rule from the list before completing typing the text.
Option 4:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
3. Select “Embedded rule”
4. A list appears with all the embedded rules. Select “RULE.A”.
Option 5:
1. Press Ctrl+Shift+E
2. A list appears with all the embedded rules. Select “RULE.A”.
Functions
The Script Statements that can be used to construct the rule.
Operators
The following operators will be supported. They are listed in precedence order, with the most tightly
binding operators listed first.
Function Operators
if ( )
then
else
Then, there are five ways to add this function to the script:
Option 1:
1. Simply type the function to the script
Option 2:
1. Expand the “Functions” list from the Variables pane
2. Double click on the “if…then…else” element of the list.
Option 3:
1. through predictive text. As the user starts typing “if…”, a list will appear with all the currently
defined variables that start with the specific characters. “if…then…else” will be one of these
variables. The user can therefore select the functions from the list before completing typing the
text.
Option 4:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
3. Select “Function”
4. A list appears with all the functions. Select “if…then…else”.
Option 5:
1. Press Ctrl+Shift+F
2. A list appears with all the functions. Select “if…then…else”.
Comment toText
There are three ways to add a comment to the script:
Option 1:
1. Simply type “//” in front of the text to be the comment
Option 2:
1. Open “Tools” from the main menu
2. Open “Insert to Editor”
3. Select “Comment”
Option 3:
Press Ctrl+Shift+C
Static Processing
Rule Structure
The typical structure of a business rule may be seen below.
Simple Rule
Validate Rule
On pressing icon Validate Rule or Key F8 the Rule is validated and Display a Message Box as below
Validated Rule
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.
Save Rule
Rule is saved in two modes
1. Save the Rule to T24
2. Save the Rule on selected location
Saved Rule
After giving a description for the validated rule click the save button which give a message box the
Rule has been saved.
Rule Saved
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.
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
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.
EB.RULES.VERSION
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
EB.RULES.HIERARCHY
Example:
Once the rule is opened by an existing user and the same rule is used by another user an error
message is prompted as the rule is locked by User [AUTHORISER] as below example
History of Rules
When saving the rules from the GUI, in the backend server routine the EB.RULES.VERSION$HIS
record automatically updated using the standard OFS mechanism and writes the record to the
database. Rules are non-inputtable via T24 but all AUDIT fields should be maintained when changing
a record.
T24 Rules table EB.RULES.VERSION$HIS updates as the rule each time updated and saved in GUI
is shown with an increment in version of history suffixed.
As below example [Cust.Salary*20001130; 13] Shows the changes made to Field Prompt, Old Value
EB.RULES.VERSION$HIS
SMS
Standard T24 security should be handled by the OFS mechanism when writing and retrieving rules
records. The user logged into Toolbox the standard OFS mechanism should check the USER record
for any SMS settings and restrict the user accordingly passing any SMS messages back the GUI.
The Standard T24 Security handled by the OFS mechanism when retrieving T24 rules tables
EB.RULES, EB.RULES.VERSION, EB.RULES.HIERARCHY has prompted with Error message
Security Violation as the applied SMS setting to USER
After Saving Rule to Rule Designer GUI the same rule user tries to open the rule [JointAC] but can’t
find the rule [JointAC] See Figure:31 Load Rule from T24 as the SMS setting are applied on the
USER