| ILOG Rules for .NET User Guides > ILOG Rule Team Server for SharePoint > Working with Rules |
Working with Rules |
PREVIOUS NEXT |
This section describes how to create, delete, and edit your rules or decision tables in Rule Team Server.
| Note |
| Reference information on the structure of business rules and decision tables is provided in Structure of Business Rules and Structure of Decision Tables. |
You may want to create a new rule inside an exsiting RuleDoc.
| Note |
| It is not possible to create a new decision table. This is done in ILOG Rule Studio for .NET. |
| Note |
| You must have the RuleDoc checked out to have the toolbar available. |
| Note |
| The best practice is to place all the rules belonging to a package inside a RuleDoc bearing the same name. |
You may want to delete a rule or decision table from your RuleDoc.
Note that deleting all the rules in a RuleDoc will not delete the RuleDoc itself, as it still may contain text, images, or objects that you may want to keep. Also, you may want to keep an empty RuleDoc to preserve its history under SharePoint.
| Note |
| Deleting a RuleDoc is explained in Delete a RuleDoc or Rule Document Library. |
| Note |
| You must have the RuleDoc checked out to have the toolbar available. |
The Rule Editor lets you edit your business rules.
The rule statements that make up a rule appear as complete phrases because they use a natural-language approach, but when constructing or editing them you see that they are made up of combinations of modifiable building blocks, which represent business terms, operators, and values. For example, in the following rule statement:
If the current load is more than 5000
the building block the current load is a business term, is more than is an arithmetic operator, and 5000 is a value.
In the Rule Editor you construct rules from the predefined building blocks by entering text or numbers in fields, or by selecting terms in lists. Note that you can filter the choices available in the list by starting to type a word or phrase.
Furthermore, a business term may be part of a longer phrase. For example, selecting an item such as the following in your drop-down list
the age of <the customer>
will require you to subsequently complete the business term <the customer> in that phrase.
More information on the structure of your rules can be found in Structure of Business Rules and Structure of Decision Tables.
| Note |
| You must have the RuleDoc checked out to edit rules in the Rule Editor. |
You can add or remove rule statements in order to refine your rules.
.
.| Note |
| If you delete a rule statement by error, you can retrieve it immediately after by clicking the Back button of your browser. |
At least one action must be specified in the action part of a business rule. Consequently, you will not be able to delete the last action of a rule.
When the condition part of a rule contains more than one statement, you can control whether the condition part of the rule is met if all or any of its rule statements are valid.
For more information on how these operators are interpreted, see Combine Condition Statements.
You can negate a condition statement by adding the following condition is not true at the beginning of the statement. (More information on this is available in section Negate Condition Statements.)
If the title of a part of a rule appears in italics, this means that it is currently empty.
You may want to enter a value in a field instead of selecting it from a drop-down list.
In large business rule applications, it is possible to reduce the number of terms that appear in your drop-down lists by the use of categories.
If your application has been setup to use categories, the Rule Editor will display the Category combo box.
Select a term in the combo box to only display in your drop-down lists terms from that category.
Selecting All means that the terms from all the categories will be displayed in your drop-down lists.
The Rule Editor will underline in red any terms that are not correct.
To remove these error messages, simply correct the term, for example by typing-in a number rather than typing-in text.
| Note |
| The Rule Editor will let you save incorrect values, contrary to the Rule Property Editor, which will only save correct properties. |
Business rules are often made simpler through the use of variables, which let you identify and subsequently reference an occurrence of something by a convenient name. This is explained in Definitions.
The Rule Editor defines one variable for each type of business term that it encounters, and identifies it with the word "the". For example, if customer is something you work with in your rules, the Rule Editor will define a variable called the customer which you can use.
If your rule requires you to refer to more than one occurrence of a customer, you have to explicitly define the other variables in the Definitions part.
The Decision Table Editor displays the rows and columns of your decision tables, and provides features that let you edit your rules.
It is made up of a table part, as well as a toolbar at the top that lets you access to features that either enhance readability or give you more information on your decision tables:
Preconditions, rule information, and messages are displayed just below the decision table. When you access these features, the icon disappears from the toolbar until you close the feature (by clicking the X at the top right of its display area).
Use the rule information icon
or click directly on a row number to display the rule at the bottom of the editor in its usual If-Then form.
Similarly, placing your cursor over a column header will display in the tooltip the entire condition or action.
To make your decision tables easier to read, you can expand or contract groups of rows (see Partitioned Cells) by clicking the + or - signs at the right of partitioned cells.
You can sort some columns in ascending or descending order by using the up and down arrows at the right of the column header (sorting is done within the partition for groups of related cells (see Partitioned Cells)).
Use the paging mode icon
if you want to only display a certain amount of rows at a given time rather than the entire table.
Once paging mode is enabled, you use the scrollbar at the right of the decision table to access the other pages of rules.
Click on the paging mode icon again to disable paging mode.
You can add rows to decision tables to create new rules (you must have the RuleDoc checked out to do so).
You can delete rows from decision tables (you must have the RuleDoc checked out to do so).
Cells are edited by either typing in values, selecting predefined values from a drop-down list, or by changing the operator that acts on a given cell.
| Warning |
| You must press ENTER with your cursor placed in the field for the changes to be captured. Otherwise you will not be able to do anything else in the Rule Editor. |
Rule Team Server advises you of errors in your decision table by:
Errors caused by incomplete or invalid expressions in your decision tables are signaled by a red mark, whereas errors caused by overlapping entries or entries with gaps are signaled by a blue mark. These are described as follows:
| Note |
| Although you can save incorrect values, the rules will not successfully deploy to the end-user applications if they contain invalid expressions. |
Rule Team Server verifies that the values you enter in the cells of a decision table match the type of value the column expects, and that the number of arguments is correct.
For example, you get an error when you do not provide both the maximum and minimum values for a range of numbers, or if you enter text when you should enter a number.
Rule Team Server verifies that the values you enter for a given condition throughout the different rows do not overlap or are not identical.
Consider for example a column for the age of the customer:
In this example, customers that are 29 years old will satisfy the condition of both rows; this is signaled as an overlap error.
Overlap errors are evaluated for all the entries in a given column, or within partitioned groups of cells (see Partitioned Cells).
Rule Team Server verifies that the cells in a condition column consider all possible cases. This ensures that there are no gaps in your tables.
Consider for example a column for the age of the customer:
In this example, customers that are 31 years old will never be taken into account; this is signaled as a gap error.
Gap errors are evaluated for all the entries in a given column, or within partitioned groups of cells (see Partitioned Cells).
It is possible to disable any action cells so that the action is not carried out for that particular row. This is equivalent to clearing the contents of the cell, except that you keep the information it contains in view of re-enabling it.
Ruleflows define the "flow" of execution of business rules and decision tables in a rule project in terms of three kinds of tasks--rule, action and flow--and the transitions between them.
Ruleflows are contained in RuleDocs and you can consult them in the Rule Editor:
Note that you cannot edit ruleflows in Rule Team Server. This is done in ILOG Rule Studio for .NET. You can, however, edit their properties in the Rule Property Editor (see Rule Properties).
Ruleflows are composed of the following parts:
Every ruleflow has one start point and at least one end point. Start and end points are graphical markers for the start and end of a ruleflow. They do not have any functional properties.
Tasks begin executing after a ruleflow's start point, and stop executing when an end point is reached.
A ruleflow consists of linked tasks. The tasks of a ruleflow contain the instructions for which rules to execute and in what order. Some tasks (rule tasks) contain a list of business rules and decision tables to execute. You can also have tasks that just perform actions (action tasks), and some that contain other ruleflows (flow tasks).
One or more actions can be attached to a task. Initial actions are applied before a task is performed, and final actions are applied after a task is performed. Initial and final actions are defined in the same way as actions for an action task.
Transitions connect tasks in a ruleflow and define the "flow" of the ruleflow from one task to another. Transitions are unidirectional, and conditions can be attached to them.
Transition conditions provide a mechanism to control the ruleflow from task to task. Transition conditions are defined the same way as conditions in a business rule. For example, with the following condition on the transition between the Eligibility and Pricing rule tasks, the Pricing rules can only be performed when the customer is eligible, otherwise the Other Offers rule task is executed.
When a condition is added to a transition, a path with no condition must always be provided to act as the "else" path, that is, the path to take when the condition is not true must be specified.
There can be many transitions after a task. However, only one of them can be an "else" path, that is, all the transitions except the else path must have conditions. For example, in the following there are three transitions after the Eligibility rule task. If the eligibility cannot be determined using the existing information the More Information rule task is executed. If the customer is definitely eligible, the Pricing rule task is executed. An else path is provided to the Other Offers rule task for the case in which the customer is definitely not eligible.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |