Create a Decision

Overview

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

If you're familiar with Decisions or decision tables, you can skip to Creating a New Decision.

What is a Decision

An Appian Decision is a design object that allows you to capture business rules and logic in a decision table. If you're new to the concept of decision tables, this section will give you a basic rundown. For a more thorough explanation, we highly recommend you check out Appian Decisions.

Fundamentally, 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:

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

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.

For more information, and some great examples that show the power and flexibility of Decisions, we highly recommend reviewing Appian Decisions.

Create a New Decision

Decisions are created within an application.

  1. From your application, click New and select Decision.
  2. Name and describe your decision, then 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. Note that every Decision must have at least one input and one output.

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. You can change the hit policy directly in the Decision table by clicking the hit policy dropdown at the top left corner of the table.

Add/Configure Inputs

Every Decision object requires at least one input. However, you can add as many inputs as you need.

To add a new input:

  1. From the top of any input column, click the column menu icon to open the column context menu.
  2. Select the "Add Input" option to launch the New Input dialog.

Note: The new column will appear to the right of the existing column. Columns can be reordered by using the "Move Right" and "Move Left" options in the column context menu.

  1. Enter a Name and Type for your new input.
  2. Check the checkbox next to the Use a dropdown to list values you can select for this input option if you want to define a list of values.
    • Selecting this option will display a Choice Values field and a Choice Labels field. Choice Values and Choice Labels in an Input work the same as a Multiple Dropdown component.
      • As you can see from our example, we have created a text input column named "state" and we have defined the list of states to choose from in the Choice Values. You can also optionally enter Choice Labels.
  3. Click Create.

To configure an existing input:

  1. From the top of your decision table, click the column menu icon to open the column context menu. Select the "Edit Input" option to launch the Edit Input dialog.
  2. Make the necessary changes and click OK.

Add/Configure Outputs

Every Decision object requires at least one output. However, you can add as many outputs as you need. If you have multiple outputs for a Decision, the result will return a dictionary. For more information, see Decisions.

To add a new output:

  1. Next to the existing output column, click the column menu icon to open the column context menu.
  2. Select the "Add Output" option to launch the New Decision Output dialog.
  3. Enter a Name and Type for your new output.
  4. Check the checkbox next to the Array (multiple values) option if your output has multiple values.
  5. Check the checkbox next to the Use a dropdown to list values you can select for this output option if you want to define a list of values.
    • Selecting this option will display a Choice Values field and a Choice Values field. Choice Values and Choice Options in an Decision output work the same as a Multiple Dropdown component.
  6. Click Create.

To configure an existing output:

  1. From the top of your decision table, click the column menu icon to open the column context menu. Select the "Edit Input" option to launch the Edit Input dialog.
  2. Make the necessary changes and click OK.

Delete an Input or Output

To delete an input or output:

  1. Open the column context menu for the input or output you want to delete.
  2. Click the Delete Input/Output option.
  3. Click OK.

Add/Configure Rows

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

  1. Select an operator from the operator dropdown list.
  2. Enter an input value and output value.
  3. Optionally, you can add information you think is relevant to this rule in the Notes column. Any notes you enter in the Notes column will not be evaluated in the decision. You can add reminders or descriptions for yourself or other designers working with this decision.

You can add more rows by clicking the +Add New Row link at the bottom of the table and duplicate any existing rules by clicking the Duplicate Rule icon.

You can change the order of your rows by using the up and down arrow buttons, which might be necessary if you are working with a Decision with a Rule Order or First hit policy.

You can also remove any row by clicking the X icon.

Additionally, you can navigate through the cells in a column or row by using your keyboard arrow keys - just like a spreadsheet!

Testing 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, view Design Guidance and Validations.

To test your Decision:

  1. In the Test pane, enter values for your input fields.
  2. Click Test.

After clicking Test, you will see a Test Output section with the type and value of the output.

If the logic passes, the decision table will highlight the matching rules in green. As you can see from our example, entering the age, state, and isMarried input values as 25, "NJ", and True results in the expected output value of 2300.

Our example also shows that the Decision is missing an age gap of 18 to 21.

If there is an error, the conflicting rules will be highlighted in red. Since our example is a decision table with a Unique hit policy, the test output and table will notify us if there are any rules with overlapping logic.

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, as shown below. In our example, we are passing three parameters in the rule because our decision has three inputs, age, state, and isMarried. Note that Decisions must use keywords when passing in parameters.

rule!IQ_determineCarInsuranceQuote(age: pv!age, state: pv!state, isMarried: pv!isMarried)

FEEDBACK