Show TOC

Procedure documentationCreating the Rules Locate this document in the navigation structure

Procedure

  1. In the Project Explorer view, expand the buyerrules node and the Rules Modeling node and choose New Rule in the context menu of the discountrules node.

  2. In the dialog box that appears, enter AnyBuyer in the field and choose OK.

    You should see the AnyBuyer node in the Outline view.

    Repeat the steps to create two more rules: BigBuyer and NoCreditBuyer.

    In the Outline view the result must be as follows:

    This graphic is explained in the accompanying text.

  3. Save the changes.

Editing AnyBuyer rule
  1. In the Outline view, choose the AnyBuyer node.

  2. In the rule editor that appears, under the If section, choose Add.

    The default condition: Operation.isSuccessful Equals true appears.

  3. Edit the default condition as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname as shown below:

      This graphic is explained in the accompanying text.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box as shown below:

      This graphic is explained in the accompanying text.

  4. Add another condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box .

  5. Add one more condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit.

    • Leave the comparator : Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box .

  6. Under the Then section, choose the Add icon and in the drop down menu that appears, choose Execute.

  7. Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ) as shown below:

    This graphic is explained in the accompanying text.

  8. Choose {(double)} and in the inline text enter the value : 10

The result must be as shown below:

This graphic is explained in the accompanying text.

Editing BigBuyer rule
  1. In the Outline view, choose the BigBuyer node.

  2. In the rule editor that appears, under the If section, choose the Add icon.

    The default condition: Operation.isSuccessful Equals true appears.

  3. Edit the default condition as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box .

  4. Add another condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter good in the inline text box .

  5. Add one more condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit.

    • Leave the comparator : Equals as it is.

    • Choose the RHS value: Default Value and enter good in the inline text box .

  6. Under the Then section, choose the Add icon and in the drop down menu that appears, choose Execute.

  7. Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ).

  8. Choose {(double)} and in the inline text enter the value : 20

The result must be as shown below:

This graphic is explained in the accompanying text.

Editing NoCreditBuyer rule
  1. In the Outline view, choose the NoCreditBuyer node.

  2. In the rule editor that appears, under the If section, choose the Add icon.

    The default condition: Operation.isSuccessful Equals true appears.

  3. Edit the default condition as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersname.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box.

  4. Add another condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyersspendinghabit.

    • Leave the comparator: Equals as it is.

    • Choose the RHS value: Default Value and enter * in the inline text box.

  5. Add one more condition and edit as follows:

    • Choose the LHS value: Operation.isSuccessful and in the drop down menu choose Buyer.getBuyerscredit.

    • Leave the comparator : Equals as it is.

    • Choose the RHS value: Default Value and enter bad in the inline text box .

  6. Under theThen section, choose the Add icon and in the drop down menu that appears, choose Execute.

  7. Choose < Action Method > and in the drop down menu, choose Buyer.setSetdiscount ( {double} ).

  8. Choose {(double)} and in the inline text enter the value : 0

The result must be as shown below:

This graphic is explained in the accompanying text.