IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Modeling processes > Building services > Building a Decision service

Adding a Decision Table component to a service

You can add a Decision Table component to a service.

The Decision Table component contains a table with a rule condition in each row. Each row in the table represents a Boolean condition that will evaluate to true or false at run time. The condition evaluates to true only if the values of all the associated variables produce matches with the provided values. The following information applies to the Decision Table component.

The steps in this procedure demonstrate how to add a Decision Table component to a decision service using example values. For your own implementation, you might not use the same steps or names.


Procedure

  1. Open the process application that contains a business process definition (BPD).

  2. Create a Decision service as described in the related topic "Adding a Decision service to a process."

  3. Drag the Decision Table component from the component palette to the service diagram.

  4. Click the Properties tab, then enter ExpenseApproval as the Decision Table component name.

  5. Click the Variables tab.

  6. Click Add Input to add variables to the service.
  7. Replace Untitled1 in the Name field with request.

  8. Click Select next to Variable Type and select the type from the list.

    If you use the Activity Wizard to create a Decision service, you can choose existing variables to add as input and output. You should use the Activity Wizard when you start with an existing activity and want to quickly create a service to implement the activity. To access the wizard, right-click an activity and select Activity Wizard from the list of options.

  9. Click Add Private.
  10. Replace Untitled1 in the Name field with approvalRequired .

  11. Click Select next to Variable Type and select the Boolean type from the list.

  12. Click the Decisions tab to open the rules editor.

  13. In the rules editor, click the plus sign to add a variable (column) to the first rule (row).

  14. From the list of available variables, select amount from the request structure.
  15. Type >250 as the variable value.

  16. In the rules editor, click the plus sign again. Make sure the first rule (row) is selected because you want to add another variable (column) to this rule.

  17. From the list of available variables, select type from the request structure.
  18. Type "director" as the variable value.

  19. In the Action Requirement field for the first rule (row), type Requires Approval .

  20. In the rules editor, click the Action section to expand it.

  21. For the Requires Approval requirement, enter the following JavaScript for the Action:
    tw.local.approvalRequired = true;

  22. In the rules editor, click the second row to select it. Create a new rule stating that employee expenses of more than $60 require approval.

  23. In the rules editor, click the third row to select it. Create a catch-all rule by typing - for both the amount and type. The - value in a variable field indicates that any variable value is considered a match.

  24. In the Action Requirement field for the third rule (row), type Auto Approval .

  25. In the Action section, enter the following JavaScript for the Auto Approval action:
    tw.local.approvalRequired = false;

  26. Click the Diagram tab.

  27. Use the Sequence Flow tool to connect the Decision Table component and the Start and End events.

Building a Decision service


Related tasks:
Adding a Decision service to a process
Declaring variables for a BPD or a service
Authoring rules using JavaScript in a Decision Table component