To better adjust to the varied factors in your business processes, you can
create a decision table. Decision tables test a series of property values to match conditions,
so that your application performs a specific action under conditions that you
define.
For example, you can define a condition in your application to approve a
loan request, if the credit score of the applicant is greater than 500 and lower than 700. You
can then add a condition that if the applicant's credit score is greater than 700, a customer
service representative prepares a special offer for the applicant.
-
In the header of Dev Studio, click .
-
In the Label field, enter a name that describes the purpose of
the table.
-
In the Apply to field, select the class in which you want to
create the decision table.
-
Click Create and open.
-
In the
Conditions
column, click the header cell.
-
In the Select a property window, in the
Property field, enter or select a property that you want to use
as a condition.
-
In the Label field, enter the name of the property.
-
Select a comparison method:
- To use a simple comparison, in the Use operator list,
select the
operator.
- To specify a range for the condition property, select the Use
range check box, and then define start range and end range.
For example: You can configure a property value to be greater than and lower than certain
amounts.
-
Click Save.
- Optional:
To consider additional factors in a decision, add more condition properties:
-
In the Conditions column, click a cell.
-
In the toolbar, click the Insert column after icon.
-
Define the condition property by repeating steps 5 through 9.
-
In the if row, click the cell under a property, and then enter a
value.
If you configure two or more conditions, enter a value for at least one of the
conditions. Your application ignores conditions without values.
-
In the Return column, enter a return result.
For example: You can configure a condition that if a credit score is greater than 500 and lower
than 700,
the
return result is to approve the case.
-
To allow for more outcomes, create additional decisions:
-
Click a cell in the if row.
-
In the toolbar, click the Insert row after icon.
-
Define the condition by repeating steps 5 through 12.
-
In the otherwise row, in the Return
column, select or enter a property that defines an application behavior when no condition
in the table returns a true value.
For example: Configure your application to reject a case.
- Optional:
To ensure that your application can process the table, check the table for conflicts by
clicking Show conflicts on the toolbar.
For example: If two rows are identical, the second row never evaluates to true and is
unreachable.
Result: A warning icon appears in rows that are unreachable or empty.
- Optional:
To increase the possibility of reaching a return value, improve the completeness of the
table by clicking Show completeness on the toolbar.
Result: The system automatically adds suggested rows to the decision table, that cover
additional cases.
-
Click Save.
Result: At run time, your application processes all rows in the table
and performs all the results from the columns that evaluate to true.