You can add a
Decision Table component to a service.
Before you begin
To perform
this task, you must be in the IBM® Process
Designer desktop
editor, which is deprecated.
About this task
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 double-dash (
-) value in a variable field
indicates that any variable value is considered a match.
- When a rule evaluates to true, the JavaScript expression that you provide as the action is started. This expression may contain any valid JavaScript.
- A rule only executes the JavaScript expression once per a rule, using the JavaScript expression associated with the first condition that evaluates to true.
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
- Open the desktop Process Designer (deprecated).
-
Open a process application that contains a business process definition (BPD).
-
Create a Decision service.
- Drag the Decision Table component from the component palette
to the service diagram.
- Click the Properties tab, then enter ExpenseApproval as
the Decision Table component name.
- Click the Variables tab.
- Click Add Input to add variables
to the service.
- Replace
Untitled1 in the Name field
with request.
- 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.
- Click Add Private.
- Replace
Untitled1 in the Name field
with approvalRequired .
- Click Select next to Variable Type
and select the
Boolean type from the list.
- Click the Decisions tab to open
the rules editor.
- In the rules editor, click the plus sign to add a variable
(column) to the first rule (row).
- From the list of available variables, select
amount from
the request structure.
- Type
>250 as the variable value.
- 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.
- From the list of available variables, select
type from
the request structure.
- Type
"director" as the variable value.
- In the Action Requirement field
for the first rule (row), type
Requires Approval .
- In the rules editor, click the Action section
to expand it.
- For the Requires Approval requirement, enter the following JavaScript for the Action:
tw.local.approvalRequired = true;
- 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.
- 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.
- In the Action Requirement field
for the third rule (row), type
Auto Approval .
- In the Action section, enter the following JavaScript for the Auto Approval action:
tw.local.approvalRequired = false;
- Click the Diagram tab.
- Use the Sequence Flow tool to connect the Decision Table
component and the Start and End events.