Decisions Component
Estimated Reading Time: 18 minutes
Overview
The Decisions component is an event component for logic-based in/then scenarios. For example, if your end-user selects radio button A, then show field B. Or, if your end-user types value X, then display pop-up Y.
Three inputs drive the Decisions component:
-
Input component: What drives the action. Any component works here, including Buttons, Radio Buttons, or Text Fields. The Decisions references the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. of the input component.
-
Output component: What reacts to the action. Again, any component works, including Panels and Field-Groups containing multiple components. The Decisions references the Property ID of the output component.
-
Decisions component: The Decision itself. You can configure the interaction between the inputs and outputs using Micro Decisions. You can set the input and output behavior by selecting the Type for each. The Micro Decisions table is where you'll set if/then rules using your defined inputs and outputs. Inputs display in the left columns of the Micro Decisions table. The column headers match the Input components' Property IDs. Outputs display in the right columns and are named using a concatenation of their ID and Type.
Here are some real-world examples of when to use a Decisions component:
-
Displaying a Country of Citizenship field after your end-user answers that they're not a U.S. citizen.
-
Showing state-specific question labels, based on your end-user's selected state of residence.
-
Adjusting a maximum loan amount based on your end-user's calculated credit score.
-
Displaying a field with the click of a button.
You can find the Decisions component in the Data & Events Processing group to the left of the Module Editor.
What You'll Learn
After completing this article, you’ll know when to use a Decisions component, how to configure its settings, and how to use it in a module.
About the Configuration Window
General
Setting |
Description |
---|---|
Property ID |
A Property ID is the unique field ID used by Unqork to track and link components in your module. The Property ID is how the software identifies your component. Using Property IDs lets you link components, creating logic-based configurations and API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. calls. Property IDs must use camel case A naming convention for computer programming. Use camelCase for Property IDs, for example: newUser, lastName, & rdoButton. (stylized as camelCase) without spaces or punctuation. |
|
The component is active and visible in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. After configuring a module, click Preview in the Module Editor to interact with the module in Express View. While active, other components and processes can reference your component. Setting the toggle to By default, the Active toggle is set to |
Notes |
Select this tab to display the component's Notes area. You can use notes to keep your teammates informed. The Notes editor offers a semi-WYSIWYG (What You See is What You Get) content editor. Built to look like a word processor, this editor lets you create, edit, and format your notes. Notes save when saving the component. |
|
Select this tab to manage your component's display settings. |
![]() |
Select this tab to manage your component's actions settings. |
|
Select this tab to manage your component's validation settings. |
|
Select this tab to manage your component's advanced settings. |
|
Select this tab to see the RBAC RBAC (Role-Based Access Control) is a method to control system access for authorized users. The role in RBAC refers to the levels of access employees have to a network. (role-based access control) settings of the component. |
|
Assign components one-word labels to help organize, identify, and group the components in your application. Consider an example from the API Specification Snippet: Field Tags are applied to Hidden components in the panelRequest and panelResponse Panels. The Field Tags identify the data type of parameters included in the API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. request and response. The API Docs Dashboard tool populates with information about each parameter’s data type, identified by the Field Tag. Field Tags act as a type of Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. group and let you group components for configuration purposes. Field Tags let you target two or more components using a simple logic component. For example, add the Field Tag tagForDecision to multiple components in your module. Open the Inputs table of a Decisions component and reference the tagForDecision Field Tag as the input of the Decisions component. The output of the Decisions component then affects all components with the tagForDecision Field Tag. Save your Field Tags by pressing Enter (Return) or adding a comma after each entry. |
|
Select this tab to open the list of supported keyboard shortcuts you can use in the component settings modal. Keyboard shortcuts include:
Additional keyboard shortcuts:
|
|
Select this tab to access the component documentation in Unqork's In-Product Help. |
Cancel |
Click this button to undo any unsaved configuration changes and return to the canvas. |
Save & Close |
Click this button to save all settings as configured and return to the canvas. |
Display Panel
Setting |
Description |
---|---|
Canvas Label Text |
A component’s Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the Module Editor. User-friendly labels make your module more accessible. Keep labels short and descriptive (a word or two) using title case. For longer entries, use sentence case. NOTE For Decisions, it's best practice to use the same value for Canvas Label Text as your Property ID: ruleXxx. |
Actions Panel
Setting |
Description |
---|---|
Trigger Type |
This setting provides the following options:
|
Execution Type |
When executing a rule, the Decisions component runs through each Micro Decision (top to bottom) to set the output. For clarity, assume that you have six configured Micro Decisions. The third and fifth Micro Decisions fulfill the Decision conditions to determine a match. The following Execution Types set the Decision's behavior:
|
Inputs
Setting |
Description |
---|---|
Property ID |
The Property ID column is where you enter inputs that your logic component references. Examples of supported inputs include:
NOTE When using a Trigger Type of Watch, enter all inputs the component must watch for in the Property ID column. TIP You can use dot notation In Unqork, Dot Notation accesses the properties of an object. The object's name comes before the period, and the property comes after. For example, to reference just the City from an Address Search component, you would enter "address.city". to reference values nested under a Property ID in the submission data Also known as Record Data. Submission data consists of information saved by Unqork components. View submission data by using the angular command, or in Record Collections..
|
Alias |
To simplify the configuration, give each component an alias. An easy approach is to assign each component a different letter of the alphabet (for example: A, B, C). |
Type |
The following input types are available for your selection:
|
Required |
Set an input to Required when it must have a value before triggering the Decision. |
Silent |
"Silent" stands for "Silent Watcher". If Silent is selected and the Trigger Type is set to Watch, the Decisions component won't trigger if that input's value changes. This setting lets you use the input data as a Micro Decision without triggering the component if that data changes. NOTE Silent only functions when the Trigger Type is set to Watch. It won't function if the Trigger Type is set to Manual. |
Outputs
Setting |
Description |
---|---|
Property ID |
For your logic component to recognize an output, you must enter the destination component's Property ID(s) here. The Property ID entered must match the Property ID used in the output component. Remember, use camel case A naming convention for computer programming. Use camelCase for Property IDs, for example: newUser, lastName, & rdoButton. (stylized as camelCase) without spaces or punctuation. |
Type |
The following output types are available for your selection:
NOTE The following output types are not supported or referenced above: Steps, Focus, Pattern, Content, and Clicked. Additionally, not all components support every output type. For example, setting a Prefix/Suffix output for a Radio Buttons component has no effect. |
Micro Decisions
Setting |
Description |
---|---|
Input Values |
Shows a column for each input component. The component's Property ID serves as the header for the column. Using the firstrow, enter the trigger value the logic component uses when triggering the output. NOTE By default, Date Input components store dates in ISO 8601 format with a timestamp of midnight UTC. For example, 2020-11-13T00:00:00Z. When referencing input values from a Date Input component, you must also use ISO 8601 format. The exception is when the Date Input component has Store Date Only enabled, in which case the date stores without a timestamp. TIP A blank value/nothing in the Input column acts as a catch-all for any Input values not otherwise defined. |
Output Values |
Shows a column for each output component. A concatenation of the component's Property ID and the Type serves as the header for each column. Using first row onward, define the behavior based on the Type. For example, _visible: yes/no. |
Validation Panel
Unit Testing
The Unit Testing tool lets you test that your Decisions component works as expected. Enter the data you want to test in the Input table and the results of the test show in the Output table. This is a good way to catch logic errors early.
To get started, click Create Test to create a new test.
Setting |
Description |
---|---|
|
Collapses or opens the Unit Testing panel. |
Refresh Fields |
Updates all Input fields to reflect changes on the canvas. |
Run All Tests |
Runs all added tests with the Input values entered. |
··· |
Additional Unit Testing settings. |
|
Makes a copy of an existing test. |
|
Removes an existing test. |
Run Test |
Runs the test with the Input values entered. |
Input Table |
Use this table to enter the information you want to test. If you have multiple inputs and want to skip testing certain inputs, leave the Value column blank. |
Input |
Automatically populates all components listed in the Decisions component’s Inputs table. |
Label |
Automatically populates the label of the connected Input component. |
Value |
Enter example data in this column that you want to test. NOTE If you enter a JSON value with a syntax error (such as a missing bracket), the cell turns yellow, indicating an error scenario. |
JSON |
Select this checkbox when you enter a Value that's written in JSON JSON (JavaScript Object Notation) is an open standard file and data interchange format. Unqork uses JSON for submission (record) data.. This can be an object, array, number, or Boolean (true/false) value. |
Output Table |
This table displays the results of your test. |
Output |
Automatically populates all components listed in the Decisions component's Outputs table. |
Label |
Automatically populates with the label of your connected Output component. |
Expected |
Enter the outcome you expect from the test you run. You can use this to compare the expected result with the actual result. NOTE This column is optional. If you leave it blank, the cell turns red when the unit test runs. |
Actual |
The result from the test you ran. |
JSON |
Select this checkbox when your result must display in JSON. This can be an array, string, or object. |
After you create a unit test, test the decisions. The Unit Testing feature populates the Input, Label, and Output fields based on the configuration of your Decisions component. You only need to complete the Value and Expected fields. When you click Run Test, you can confirm the Expected results match the Actual results.
TIP To learn more about the Testing Tool, view our Unqork Testing Tool article.
Advanced Panel
Setting |
Description |
---|---|
Set Execution |
Select if and what is executed when this component triggers. |
Disable Execution |
If Disable Execution is set to By default, Disable Execution is set to |
Execute All Child Decisions |
When set to By default, Execute All Child Decisions is set to |
Execute Decisions From Last To First |
Reverses the trigger order of child decisions. When set to |
Set Debounce |
The number of milliseconds that pass before the form loads this component. For larger modules, increasing the debounce value prevents the Decisions component from triggering before all components load in. |
TIP To learn about all of this component's settings, view our Decisions Component article in the Document Hub.
Adding a Decisions Component
In this scenario, you'll show a follow-up question when an end-user answers No to "Are you a citizen of the United States?" These instructions assume that you have an open module saved with a title.
In this configuration, you need the following components:
-
1 Radio Buttons component
-
1 Text Field component
-
1 Decisions component
Configure the Radio Buttons Component
This component asks the end-user if they're a citizen of the United States. If the end-user answers Yes, this is the end of the process. If the end-user answers No, the process continues. This Radio Button is the input for your Decisions component's if/then rule.
1. | Drag and drop a ![]() |
2. | In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter citizenCheck. |
3. | In the Label Text field, enter Are you a citizen of the United States?. |
4. | Click ![]() |
5. | Complete the Values table as follows: |
Option Label | Value to Store in Submission Data | |
---|---|---|
1 |
Yes |
yes |
2 |
No |
no |
6. | From the component's configuration window, click ![]() |
7. | In the Trigger field, enter ruleCitizen. You'll set up this component in a later step. |
8. | Click Save & Close. |
Configure the Text Field Component
This component stays hidden until the end-user answers No to the question. After selecting No, the Text Field displays, and the end-user can add their country of citizenship. This Text Field is the output for your Decisions component's if/then rule.
1. | Drag and drop a ![]() ![]() |
2. | In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter whatCountry. |
3. | In the Label Text field, enter If no, what country?. |
4. | Under Default State Options, set Hide Field to ![]() |
5. | Click Save & Close. |
Configure the Decisions Component
Your Decisions component holds the logic behind your if/then rule. In this example, if the end-user selects No in the Radio Buttons component, then the Text Field component displays.
1. | Drag and drop a ![]() ![]() |
2. | In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and the Canvas Label Text fields, enter ruleCitizen. |
3. | Click ![]() |
4. | Complete the Inputs table as follows: |
Property ID | Alias | Type | |
---|---|---|---|
1 |
areYouACitizen |
|
exact |
NOTE Setting an output Type of exact lets you use exact values in the Micro Decisions table. Exact is a good option because there are only two possible values from the Radio Buttons component: yes and no.
5. | Complete the Outputs table as follows: |
Property ID |
Type |
|
---|---|---|
1 |
whatCountry |
visible |
NOTE Setting an output Type of visible lets you hide or display the field referenced in the Property ID column. So, your Text Field displays or hides based on the end-user's Radio Buttons selection. You'll set this up in the Micro Decisions table.
6. | Complete the Micro Decisions table as follows: |
Input Values | Output Values | |
---|---|---|
citizenCheck | whatCountry_visible | |
1 |
no |
yes |
2 |
|
no |
7. | Click Save & Close. |
8. | Save your module. |
Preview your module in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. After configuring a module, click Preview in the Module Editor to interact with the module in Express View, and test it out:
Resources