Create an Advisor Rule Set Using the CER Editor

The first task is to create a rule set using the CER Editor that determines whether or not the advice is displayed. Note that the example advice will be displayed if, a person's marital status is "married" and no relationship of type "spouse" has been entered. Therefore, we must configure a rule set that first looks at a person's marital status and then looks at the person's relationships in order to evaluate whether or not to display the advice. We start by creating the new rule set:
  1. Login to Application Administration.
  2. Within the Shortcuts area of the Administration Workspace area, select Rules and Evidence.
  3. Select the Cúram Express Rule Sets link.
  4. From the Action menu, select New to create a new rule set.
  5. Name the rule set SpouseRuleSet and click the Save button. Assign the rule set to a category if appropriate.
  6. In the Cúram Express Rule Sets tab, search for the newly created SpouseRuleSet.
  7. In the Actions menu for the SpouseRuleSet , select Continue Editing. This will open a new tab link containing the CER Editor.

We now need to design the logic for the SpouseRuleSet. From a business perspective, the advice is provided on the Person Home page under the condition that this person is married and no spousal relationships have been recorded for the person. As this is a simple logic, we can jump directly to the CER Editor to design the rules implementation.

The implementation works as follows. First we determine the person for which the advice is displayed using the concernRoleID parameter from the Person_homePage. The concernRoleID is received from the Advice Context. We then search for the person and his or her associated relationships using the concernRoleID. Finally, by checking if the person's marital status is equal to married and comparing the number of spouse relationships with '0', we can determine if the advice should be provided. To design this implementation, we complete the following steps in the CER Editor:

  1. From the Rule Class menu item, create new class called SpouseAdvice.
  2. In the Properties tab, click the Edit link beside the Extends field.
  3. Use the Change link to let the SpouseAdvice rule class extend AbstractAdviceContext within the CoreAdvisorRuleSet.
  4. From the Attribute menu item, create the following new attributes for the SpouseAdviceRuleClass: concernRoleID, adviceContextID, advice, and description in the SpouseAdvice rule class.
  5. Set the Data Type field for each new attribute. For the concernRoleID attribute, set the Data Type field to be NumberParameter from the CoreAdvisorRuleSet. For the adviceContextID attribute, set the Data Type field to be Number. For the advice attribute, set the Data Type field to be List of AbstactAdviceItem in the CoreAdvisorRuleSet. For the description attribute, set the Data Type field to be Message. From the Rule Class menu item, create a new rule class called SpouseAdviceItem. Let the SpouseAdviceItem rule class extend from AbstractAdviceItem within the CoreAdvisorRuleSet.
  6. From the Attribute menu item, create the following new attributes for the SpouseAdviceItem rule class: adviceText, showAdvice, priority, status, category, adviceContext, description, and ConcernRoleID.
  7. Set the Data Type field for each new attribute. For the adviceText attribute, set the Data Type to be String. For the showAdvice attribute, set the Data Type field to be Boolean. For the priority attribute, set the Data Type field to be the AdvicePriority code table. For the status attribute, set the Data Type field to be the AdviceStatus code table. For the category attribute, set the Data Type field to be the AdviceCategory code table. For the adviceContext attribute, set the Data Type field to be Number. For the description attribute, set the Data Type field to be Message. For the concernRoleID attribute, set the Data Type field to be Number.
  8. Drag a Code Table operator onto the priority attribute. Within the Properties tab of the operator, set the Table to be AdvicePriority and set the value to be AP2001.
  9. Drag a Code Table operator on the status attribute. Within the Properties tab of the operator, set the Table to be AdviceStatus and set the value to be AS2002.
  10. Drag a Code Table operator on the category attribute. Within the Properties tab of the operator, set the Table to be AdviceCategory and set the value to be AC2001.

Now we have extended the essential attributes and we can go on to add the logic to the rules. First we must determine if the person is married or not as follows:

  1. Create a new Person attribute for the SpouseAdviceItem rule class. For the Person attribute, set the Data Type field to be Person from the ruleset ParticipantEntitiesRuleSet.
  2. Drag a Search operator onto the Person attribute. Double click the Search operator to open the Edit Search dialog, enter the Data Type Person previously mentioned.
  3. Add a New Match to the Search operator and then drag a reference to it that references the concernRoleID attribute within the SpouseAdviceItem rule class.
  4. Check the Single Item checkbox in the Properties tab of the Search operator.
  5. Create a new attribute for the SpouseAdviceItem rule class and call it isMarried.
  6. Set the Data Type field for the new attribute to be Boolean.
  7. Drag a Compare operator to the new attribute. Edit its expression to compare the maritalStatus within the Person attribute to the Codetable MaritalStatus with the value MS2.

Now we calculate how many spouse relationships the person has as follows:

  1. Create a new attribute for the SpouseAdviceItem rule class and call it relationships. For the relationships attribute, set the Data Type field to be a List of type ConcernRoleRelationship from the rule set ParticipantEntitiesRuleSet.
  2. Drag a Search operator onto the Relationships attribute. Double click the attribute to open the Edit Search dialog,enter the Data Type ConcernRoleRelationship just mentioned.
  3. Add a New Match to the Search operator and drag a reference to it that references the concernRoleID attribute within the SpouseAdviceItem rule class.
  4. Create a new attribute for the SpouseAdviceItem rule class and call it numOfSpouseRelationships with the Data Type Number.
  5. Drag a Size operator onto the new attribute. Then drag a Filter operator inside the Size operator.
  6. Within the Filter operator, for the Empty List element, let this refer to the relationships attribute. For the Empty Member element, drag a new Compare operator onto it that compares the relationshipType in within the relationships attribute with the Codetable RelationshipTypeCode value RT6.

Finally, we can determine the result of the previous steps as follows:

  1. Open the showAdvice attribute within the SpouseAdviceItem rule class.
  2. Drag the AND operator onto it, making the isMarried the first condition. For the second condition, add a Compare operator beside the isMarried condition that compares if the numOfSpouseRelationship is equal to 0.
  3. Open the adviceText attribute within the SpouseAdviceItem rule class.
  4. Drag a String properties operator onto the attribute and within the Properties Tab, give it a value of startCapture.
  5. Open the advice attribute within the SpouseAdvice rule class.
  6. Drag a Fixed List operator onto the attribute, and fill the Data Type of this operator to be AbstractAdviceItem.
  7. Drag a Create operator onto the Fixed List operator, and then create the SpouseAdviceItem rule class with parameters. The parameter concernRoleID within SpouseAdviceItem must refer to concernRoleID in SpouseAdvice. The parameter adviceContext within SpouseAdviceItem must refer to adviceContextID in SpouseAdvice.
  8. Save and validate the rule set within the CER Editor.
  9. If no errors occur on validation, publish the rule set in application administration using the Publish option on the Cúram Express Rule Sets tab.