ILOG Rules for .NET User Guides > ILOG Rule Solutions for Office > Writing and editing rules > Tutorial: Editing rules in Word 2007 > Step 3: Create 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 or equal to $90. To help you write the rule, you will use the Vocabulary pane.

Insert a new rule
  1. Scroll to the bottom of the document and locate the section labeled "Coverage Special Offer"
  2. Select the paragraph containing the placeholder "[Coverage Special Offer: Eligibility]".
  3. On the Rules tab, in the Write group, click the upper half of the Insert Rule button.
  4. images/ribbongroup_write.png
    A new rule outline is inserted into the RuleDoc, and the completion menu opens automatically with the <condition> placeholder selected.
  5. Click inside the name of the rule, delete the existing text and change the name of the rule to "Coverage Special Offer: Eligibility".
  6. Notice that the name of the rule is displayed inside a content control, with the label "Name". Be careful not to delete the content control box itself when modifying the name of the rule.
  7. Click Save (or press CTRL+S) to save your changes.
Insert a condition statement
  1. If the Vocabulary pane is not visible, on the Rules tab, in the View group, click Vocabulary Pane to display the Vocabulary pane.
  2. images/ribbongroup_view.png
    The Vocabulary pane lists all the available phrases and keywords that make up your predefined business vocabulary. The Vocabulary pane can be particularly useful to help you identify valid phrases to use when writing your business rules.
    In this example, you need to insert a condition statement to check the amount of insurance coverage associated with a rental agreement. You will use the Vocabulary pane to identify the correct phrase to use in your business rule.
  3. In the search box at the top of the Vocabulary pane, type the word coverage.
  4. As you type, the options listed in the vocabulary pane are filtered so as to only show those phrases that contain the word "coverage".
    You should see the phrase "The coverage subtotal of <a rental agreement>" as one of the listed options.
  5. Click the <condition> placeholder in the rule you just created and type The coverage.
  6. The option "The coverage subtotal of <a rental agreement>" is selected in the completion menu.
  7. Press ENTER to insert the selected phrase.
  8. The placeholder "<a rental agreement>" is selected in the document and the completion menu appears with the option "the rental agreement" selected.
  9. Press ENTER to replace the placeholder <a rental agreement> with the selected phrase.
  10. Press SPACE, then type is at least
  11. The option "is at least <a number>" is selected in the completion menu.
  12. Press ENTER to insert the selected phrase.
  13. The placeholder "<a number>" is selected.
  14. Type 90 to replace the selected placeholder.
  15. Your rule should now read as follows:
    If
        The coverage subtotal of the rental agreement is at least 90
    Then
        <action> ;
Insert an action statement
  1. Click the <action> placeholder.
  2. The completion menu appears.
  3. Type the word The, then use the completion menu to insert the phrase "The rental agreement".
  4. Press SPACE, then use the completion menu to insert the phrase "qualifies for the <enter a name> offer".
  5. Replace the placeholder <enter a name> with the option " String :"" ".
  6. The "enter a string" placeholder between the quotation marks is selected automatically.
  7. Type the word "Coverage" to replace the placeholder text. Do not delete the quotation marks from around the text string.
  8. Your new rule is now complete, and should read as follows:
    If
        The coverage subtotal of the rental agreement is at least 90
    Then
        The rental agreement qualifies for the "Coverage" offer ;
  9. Click Save (or press CTRL+S) to save your changes before continuing.

Next: Step 4: Define multiple conditions for a rule