Create a Decision

Overview

This page explains how to create and configure a decision object. If you're looking for detailed design information, see Decision Object and Appian Decisions.

If you're familiar with decisions or decision tables, you can skip to Create a new decision.

What is a decision?

A decision is a design object that allows you to capture business rules and logic in a decision table. A decision table takes input values, looks for matching rows in a table, and returns the outputs associated with the matching rows.

For example, to determine the legal drinking age:

decision example

A decision object in Appian can capture the rules of decision table in an equally readable format:

Appian decision example

In our example, we use the from operator for the range 19-20. This operator evaluates an inclusive range of values so if we applied it to the range of 1-3, the numbers 1, 2, and 3 would be evaluated in our rule. If we used the between operator, which evaluates an exclusive range of values, only the number 2 would be evaluated in our rule.

Create a new decision

To create a decision object:

  1. In your application, go to the Build view.
  2. Click NEW > Decision.
  3. In the Create Decision dialog, configure the following:

    Property Description
    Name The name that is used when evaluating the decision.
    Descriptions A short description about the decision object.
    Save In The rule folder that the decision is saved into.
  4. Click CREATE.

After creating your new decision object, you will see a prepopulated table with four rows, two blank input columns, one blank output column, and a notes column.

Default decision table

Select a hit policy

The hit policy specifies how your decision evaluates overlapping rules. Each hit policy defines what outputs will be returned when the decision is evaluated:

  • Unique: Returns outputs for only one possible match. All rows must be unique.
  • First: Only returns outputs for the first match.
  • Rule Order: Returns outputs for all matches in rule order.

The default hit policy for a new decision is Unique.

To change the hit policy:

  1. In the decision object, click the U to open the hit policy dropdown.

    hit policy dropdown

  2. Select the hit policy.
  3. Click SAVE CHANGES.

Configure inputs

Every decision object requires at least one input. When you create a new decision, the table will be populated with two inputs.

You can edit the existing inputs, or add your own. You can add as many inputs as you need. If needed, you can also delete inputs.

Edit an existing input

To edit an existing input:

  1. From the top of any input column, click and select Edit Input.
  2. In the Edit Input dialog, edit the following properties as needed:

    Property Description
    Name The name of the input. This name will appear as the title of the column.
    Type The data type of the input.
    Use a dropdown… Determines whether you can select input values based on a predefined set of values, or whether you can manually enter them. By default, this option is not selected.
  3. Click OK.

Add a new input

To add a new input:

  1. From the top of any input column, click and select Add Input.
  2. In the New Input dialog, configure the following properties:

    Property Description
    Name The name of the input. This name will appear as the title of the column.
    Type The data type of the input.
    Use a dropdown… Determines whether you can select input values based on a predefined set of values, or whether you can manually enter them. By default, this option is not selected.
  3. Click CREATE. The new column will appear to the right of the existing column.

    Columns can be reordered by clicking on the column and selecting Move Right or Move Left.

Delete an input

To delete an input:

  1. From the top of any input column, click and select Delete.
  2. In the Delete Input? dialog, click DELETE INPUT.

Configure outputs

Every decision object requires at least one output. When you create a new decision, the table will be populated with one output. You can edit the existing output, or add your own.

You can add as many outputs as you need. If you have multiple outputs, the result will return a dictionary.

Edit an existing output

To edit an existing output:

  1. From the top of any output column, click and select Edit Output.
  2. In the Edit Input dialog, edit the following properties as needed:

    Property Description
    Name The name of the input. This name will appear as the title of the column.
    Type The data type of the input. Select the Array (multiple values) checkbox if your output has multiple values.
    Use a dropdown… Determines whether you can select input values based on a predefined set of values, or whether you can manually enter them. By default, this option is not selected.
  3. Click OK.

Add a new output

To add a new output:

  1. From the top of any output column, click and select Add Output.
  2. In the New Output dialog, configure the following properties:

    Property Description
    Name The name of the input. This name will appear as the title of the column.
    Type The data type of the input. Select the Array (multiple values) checkbox if your output has multiple values.
    Use a dropdown… Determines whether you can select input values based on a predefined set of values, or whether you can manually enter them. By default, this option is not selected.
  3. Click CREATE.

Delete an output

To delete an output:

  1. From the top of any output column, click and select Delete.
  2. In the Delete Output? dialog, click DELETE Output.

Add decision rules

After creating your input and output columns, you can now add your decision rules to the table one row at a time.

To add a decision rule:

  1. In the first row of each input column:
    • Use the dropdown to select an operator. Depending on the data type of the input, the operator values will differ.
    • Enter a value.
  2. In the first row of each output column, determine the value to return based on the results of the inputs.
  3. In the Notes column, add any relevant information. This column will not be evaluated in the decision, it is used for reminders or descriptions for you and other developers.
  4. Click + Add New Row to add another decision rule.
  5. Click Duplicate Row to duplicate a decision rule.
  6. Click Move Up or Move Down to change the order of your decision rules.

    This might be necessary if your decision has a hit policy of Rule Order or First.

  7. Click Delete Row to remove a decision rule.

For example, the first decision rule in the table below determines that if a person is below 18 and they are from any country, they cannot be served alcohol.

configure decision rows

Test your decision

Testing will check your decision logic in real time. Not only does the decision table provide feedback about any gaps in your logic, it also validates any overlapping rules depending on the hit policy of the decision.

For more information, see Design Guidance.

To test your decision:

  1. In the Test Inputs pane, enter sample values for your input fields.
  2. Click Test. The Test Output section populates with the type and value of the output.

If the logic passes, the decision table will highlight the matching rules in green. For example, entering the following test values return an expected output:

test decision green

If there is an error, the conflicting rules will be highlighted in red. For example, the following decision table uses a Unique hit policy, but there are two decision rules with the same inputs. When you test the decision, the test output and table will notify you that there are rules with overlapping logic.

validate rules

Use a decision in other expressions

Decisions can be called from any expression, so they can be reused across multiple objects throughout the system.

Decisions are similar to other Appian rules. You can call a decision in an interface or process model by using the rule! domain.

In the example below, we are passing three parameters in the rule because our decision has three inputs: age, state, and isMarried.

Decisions must use keywords when passing in parameters.

1
rule!IQ_determineCarInsuranceQuote(age: pv!age, state: pv!state, isMarried: pv!isMarried)
Open in Github Built: Mon, Nov 21, 2022 (01:53:06 PM)

On This Page

FEEDBACK