Components of a Decision Table
Learn what are the components of a Decision Table in ProcessMaker Platform.
Overview
The Decisions Table package must be installed to use Decision Table Editor.
A Decision Table is a two-dimensional grid that outlines the different possible business conditions that can occur for a particular data output. The data output then affects the workflow routing for any Request that references that decision table. The Decision Table represents business rules from which to evaluate how to route Requests for a Process. Below is a Decision Table edited in Decision Table Editor. Decision Tables are Decision Model and Notation (DMN) files.
![](https://docs.processmaker.com/~gitbook/image?url=https%3A%2F%2F1886830008-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FkUTG8hlbL6K7ro1gfKkH%252Fuploads%252FSNaOR0i84BYGd6UtHpyG%252FDecision%2520Table%2520example.png%3Falt%3Dmedia%26token%3D06f5fdd2-76a8-42ce-bda7-53c7556b0187&width=768&dpr=4&quality=100&sign=25a397f&sv=1)
What is a Decision?
A Decision Table is a set of decisions. Each row in a Decision Table represents one decision. In the example in the Overview, there are three decisions. As a best practice, describe each decision for greater clarity. Collectively, this set of decisions represents business rules for that use case.
Each decision contains the following:
Condition(s): Conditions are the inputs that must occur for each decision. A decision variable represents one condition in each decision. A decision may be composed of multiple conditions, and therefore affect multiple Request variables. However, each decision must have at least one input. In the example in the Overview, there are four possible inputs, though in the second decision only three inputs are evaluated; the Commercial Industry input is not considered in that decision because it either is not relevant or is not expected to be in that Request's JSON data model to be evaluated. A Decision Table may contain many decisions that apply to multiple intended Process models. Therefore, some inputs or outputs may not apply to all Process models that a Decision Table is to be referenced.
Output(s): The output sets the value to a specified Request variable when the input(s) for each decision occur. This output Request variable then affects workflow routing in that Request. A decision may have multiple outputs, and therefore affect multiple Request variables. However, each decision must have at least one output. Outputs in a Decision Table are denoted with blue coloring in the table header. In the example above, there is one output.
Each input and output for a decision has the following:
Label: Both inputs and outputs have labels that briefly describe that aspect of the decision. The label is independent of any labels used in Screen design for a control label or a Process model element label since Decision Tables are independent of Processes. Labels are in bold in the Decision Table header.
Decision variable name: Both inputs and outputs must have a decision variable for that input or output:
Input(s): The decision variable provides a value for that input to evaluate that condition. When configuring a Decision Task connector, data from the in-progress Request maps to the decision variable for each input so as to evaluate that Request data's condition.
Output(s): The decision variable value in that decision outputs that value to the in-progress Request's JSON data model, thereby affecting workflow routing for that Request. Therefore, it is important to understand the names of the decision variables and how they would correspond with an intended Request variable.
Request variables display below their labels in the header.
What is a Decision Variable?
A decision variable represents the value for decision input or output. Decision variables are independent of Request variables because a Decision Table can be used in multiple Processes. The name of the decision variable can be identical to that of a Request variable, but is not required. After a Decision Task connector references a Decision Table during its configuration, map the referenced Decision Table's variables to and from the Request variables to transfer Request data to and from the Request. Therefore the decision variable names can be the same or different from the names of Request variables intended to transfer data.
By default, decision variables are of string
data type. A decision variable may be of any of the following data types:
boolean: The decision variable represents one of two possible values (usually denoted
TRUE
andFALSE
).date: The decision variable represents a date. The date is in the following format:
YYYY-MM-DD
. Example:"2020-07-01"
.datetime: The decision variable represents a datetime. The datetime is in the following format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
.number: The decision variable represents a number.
string: The decision variable represents a string.
time: The decision variable represents a time. Example:
14:25:15
.
Conditions and Examples Using Conditions
The following are some examples of conditions. Take into account that the Decision Tables package uses the Drools engine to evaluate business rules, which is based on the Decision Model and Notation (DMN) and Friendly Enough Expression Language (FEEL) standards. Therefore, to view more condition examples, see Drools Documentation and Drools DMN FEEL handbook.
String examples: See the following examples that use strings within conditions:
Concatenate strings by using the
+
symbol as follows:Split strings using the
split
function. The next example splits a string by specifying the delimiter symbol, in this case that is space (\\s
).
Date example: The following example uses a date, specifically to get its year by using
.year
after the date:Number examples: See the following examples that use number ranges within conditions. These examples use range syntax instead
AND
orOR
operators, which are not supported by the DMN and FEEL specifications:A range where the number is greater than or equal to 100000 and less than 199999:
A range where the number is less than 100000:
Mustache Syntax in Conditions
Use mustache syntax {{variable_name}}
to use Request variables and Magic Variables in your Decision Table conditions. In this way, expressions can compare input values against other dynamic variables coming from the request data model. This syntax avoids hard-coded constant values.
![](https://docs.processmaker.com/~gitbook/image?url=https%3A%2F%2F1886830008-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FkUTG8hlbL6K7ro1gfKkH%252Fuploads%252FcRok1iTmM8Yh3Jv0SNCM%252FSelecci%25C3%25B3n_001.png%3Falt%3Dmedia%26token%3D99e69337-6c25-4968-9a45-247764ff16ab&width=768&dpr=4&quality=100&sign=1685ba31&sv=1)
There are different uses, such as the following:
Some FEEL expressions require an explicit reference to the variable. For example,
contains(variable, string)
. Use mustache brackets to reference the variable in order to search for the string inside of it. You may also use mustache brackets to reference a separate value for a string if it is not a constant.Follow these steps to reference Collection data:
In a condition, enter
{{
. A gray-colored data icon suggests possible Collections to call values within it.Select a Collection.
Press the
TAB
key. The autocomplete enters a mustache syntax expression with a Data icon to access the selected Collection. If there are no Collections, the suggestion disappears.
Related Topics
What is a Decision Table?Manage Decision TablesImport a Decision Table Into Decision Table EditorAdd an Input or Output Column to a Decision TableChange the Data Type for a Decision VariableMove an Input or Output Column in a Decision TableRemove an Input or Output Column from a Decision TableAdd a Decision to a Decision TableRemove a Decision from a Decision TableSave a Decision TableExport a Decision Table from Decision Table EditorClose Decision Table EditorLast updated