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.
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.
Decisions are created within an application.
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.
The hit policy specifies how your Decision evaluates overlapping rules. Each hit policy defines what outputs will be returned when the decision is evaluated:
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.
Every Decision object requires at least one input. However, you can add as many inputs as you need.
To add a new input:
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.
To configure an existing input:
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:
To configure an existing output:
To delete an input or output:
After creating your input and output columns you can now begin to add your Decision rules to the table one row at a time.
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 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:
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.
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)