ILOG Rules for .NET User Guides > ILOG Rule Team Server for SharePoint > Tutorial: Editing Rules

This tutorial guides you through the following aspects of editing business rules:

images/tms_time.png You need about 20 minutes to complete this tutorial.

Once you have checked out the RuleDoc of the tutorial, you have the option of carrying out an equivalent tutorial in the ILOG Rule Solutions for Office environment. Consult the Tutorial section of the ILOG Rule Solutions for Office online help for more information.

Note
You must have the ILOG Rules Tutorial Page entry in the Shared Documents document library to do this tutorial. If this entry is not available, contact your Rule Team Server Administrator.

Scenario

This tutorial uses the example of a car rental agency, EU-Rent Car Rental. The business rule application needs to handle rapidly evolving business policies that govern car rentals. For example, EU-Rent offers a variety of discounts to customers depending on the type of car rented and the length of the rental. Discount types and amounts may change often. These changes can be implemented by simply updating the business rules used by the application.

This tutorial demonstrates how to modify and create rules used for calculating rental discounts.

Note
The scenario for this tutorial is inspired by the EU-Rent Car Rental use case specification, produced by the Business Rules Group (http://www.businessrulesgroup.org/brghome.htm).

Step 1: Checking Out and Opening the Pricing RuleDoc

In this step, you open and become familiar with the contents of a sample RuleDoc. The sample document describes the pricing policies for special offers applicable to EU-Rent car rental agreements and contains the business rules that actually implement these policies directly in the company's customer-facing IT applications.

  1. In the Shared Documents document library, click ILOG Rules Tutorial Page.
    Note
    If the ILOG Rules Tutorial Page entry is not available, contact your Rule Team Server Administrator.
  2. This displays the ILOG Rules Tutorial Page, which contains the rule document library as well as a RuleDoc Browser, Rule Editor, and Rule Property Editor.
  3. In the rule document library, place your cursor on the Pricing RuleDoc name and click the arrow to the right so that the drop-down list appears, select Check Out and then click OK.
  4. This locks the document for editing. No one else can modify the document until you check it back in.
  5. Select the Pricing RuleDoc option button.
  6. The RuleDoc Browser lists the available rules in the RuleDoc Browser.
  7. In the RuleDoc Browser, select the Experienced Driver Special Offer: Eligibility option button.
  8. The rule is displayed in the Rule Editor and its properties in the Rule Property Editor.

Step 2: Updating a Business Rule

In this step, you modify the eligibility conditions for the Experienced Driver special offer. You modify the business rule Experienced Driver Special Offer: Eligibility to raise the minimum age requirement, and add a new condition so that the offer only applies to customers with Platinum status.

To update a value in a rule
  1. In the Rule Editor, click 40 in the condition part of the rule.
    Note
    You must have the RuleDoc checked out to edit rules in the Rule Editor.
  2. In the text field that appears, change the value from 40 to 50 by typing over the existing value, and then press ENTER.
  3. The rule should now be as follows:
    If
     the age of the customer of the rental agreement is at least 50
    Then
     the rental agreement qualifies for the Experienced Driver offer
     display the message: The rental agreement is eligible for the Experienced Driver special offer.
To add a new condition to a rule
  1. Click the arrow icon at the end of the row in the condition (If) part of the rule to add a new condition.
  2. Click <select a condition>.
  3. Type the word the, and then press SPACE.
  4. As you type, the completion menu is updated so that only those options that start with the word "the" are listed.
  5. Continue typing the word frequent.
  6. The option the frequent customer status of <customer> should now be selected in the completion menu, as it is the only valid phrase available.
  7. Press ENTER to insert the rest of the phrase into the rule.
  8. Click <select a customer>.
  9. Select the customer of <rental agreement> from the completion menu.
  10. Click <select a rental agreement>.
  11. Select the rental agreement (Variables) from the completion menu.
  12. Click <select a frequent customer status>.
  13. Select Platinum from the completion menu.
  14. The rule should now be as follows:
    If all of the following conditions are true:
     - the age of the customer of the rental agreement is at least 50
     - the frequent customer status of the customer of the rental agreement is Platinum
    Then
     the rental agreement qualifies for the Experienced Driver offer
     display the message: The rental agreement is eligible for the Experienced Driver special offer.
     

Step 3: Creating a New Rule

In this step, you create a new rule to check whether or not a rental agreement is eligible for a special discount. For a rental agreement to be eligible, the value of the insurance coverage included in the rental agreement must be greater than or equal to $90.

  1. In the RuleDoc Browser, click New Rule.
  2. Set the Name to Coverage Special Offer: Eligibility.
  3. Set the Package to Pricing.
  4. Click OK.

Your new rule is listed in the RuleDoc Browser, and is selected by default.

To define the conditions
  1. In the Rule Editor, click If to expand the condition part of the rule.
  2. Click <select a condition>.
  3. Select the coverage subtotal of <rental agreement> by selecting the choice directly in the completion menu, or by starting to type the phrase to filter the choices, and then pressing ENTER.
  4. Click <select a rental agreement>, and then select the rental agreement (Variables) from the completion menu.
  5. Click equals.
  6. Select <number> is at least <number> in the completion menu.
  7. Click <enter a number>, type 90, and then press ENTER.
  8. The rule should now be as follows:
    Definitions...
    If
     the coverage subtotal of the rental agreement is at least 90
    Then...
    Else...
     
To define the action
  1. Click Then, and then click <select an action>.
  2. Select <rental agreement> qualifies for the <enter a name> offer from the completion menu.
  3. Click <select rental agreement>, and then select the rental agreement (Variables).
  4. Click <enter a name>, type Coverage, and then press ENTER.
  5. Your new rule is now complete, and should be as follows:
    Definitions...
    If
     the coverage subtotal of the rental agreement is at least 90
    Then
     the rental agreement qualifies for the Coverage offer
    Else...

Step 4: Modifying a Property of a Rule

In this step, you modity a rule property in the Rule Property Editor to update the description of the Experienced Driver Special Offer: Eligibility rule.

  1. In the RuleDoc Browser, select the Experienced Driver Special Offer: Eligibility option button.
  2. In the Rule Property Editor, click in the Documentation text field that contains the following text: "This business rule defines when the Experienced Driver special offer is applicable. The Experienced Driver special offer is applicable when the customer is at least forty years old."
  3. Replace the word forty with fifty to take into account the change you made previously to the rule, and then press ENTER.

Step 5: Handling Errors

In this step, you learn how the RuleDoc Editor handles errors in your RuleDocs.

  1. In the RuleDoc Browser, select the rule Default Special Offer: Pricing.
  2. View the rule in the RuleDoc Editor.
  3. Notice how the rule is not editable and the following error message appears: "This rule appears to be impossible to edit in the Web Editor because of the errors it contains. You can use Rule Solutions for Office or Rule Studio to edit this rule."

If you want to correct errors in a RuleDoc, you must either edit the RuleDoc in the ILOG Rule Solutions For Office environment, or ask a developer to correct the errors for you in ILOG Rule Studio for .NET.

Step 6: Quitting the tutorial

  1. In the rule document library, place your cursor on the Pricing RuleDoc name and click the arrow to the right so that the drop-down list appears.
  2. Click Discard Check Out.
    Note
    Normally, you would select Check In to save your modifications. However, for the purposes of this tutorial, you can discard changes to prevent overwriting the original document.
  3. Click OK to confirm.