Expressions-based Conditionality
Introduction
Risk Assess features expressions-based conditionality within Risk Assess programs. Users can configure questions to be conditional based on responses to KPI- and component-level questions with the Expression System language.
Program administrators have the ability to get to the level of specificity they need in order to assess the risk of doing business with a supplier.
How it works
Risk Assess now includes an updated expression system in conditionality. Below is a list of basic rules for the new system:
- Users can write expressions on the KPI types and components listed below.
- Users can only write conditional expressions (i.e., expressions that evaluate to true/false)
- Only one expression statement can be added per KPI. However, users can write compound statements (e.g., KPI[1.1] == "Yes" AND KPI[2.1] == "No")
- Expressions are not case sensitive
- Expressions are used to determine if a question will show based on a response from a previous question (e.g., Show question 2 if question 1 is "Yes"). The expression statement is written on question 2
- Expressions can be written to determine whether to display components or KPIs based on the answer to a program’s KPI, other KPIs of the program, or component
- Expressions are written in the program wizard on a new conditionality page
- If an expression is included in the Expression field, it will hide/show the KPI
- If an expression is included in the Component Expression field, it will hide/show the component
- Users may save their work on the Conditions page to finish later—even if their expressions are invalid
The Enable Copy Previous Item Results program option may overwrite the visibility (i.e., hiding/showing a KPI or component) set by expressions. As a result, we recommend that you disable this option if you run your program as robo.
KPI expression statements
Below are examples of KPI expression statements in Risk Assess. This feature has been available since version r19.7.0.
KPI | Expression Statement Examples |
---|---|
Yes/No |
|
IsNull/IsNotNull |
|
Numeric |
|
Component expression statements
Users can now write conditional expression statements on select components.
When a component is referenced in an expression statement, the field name of the component should be referenced. Do not refer to the display name of the component.
Similarly, if the expression statement refers to a setup data value, the setup code should be referenced. Do not refer to the display name of the setup data value.
This feature has been available since version r19.8.0.
Components | Expression Statement Examples | Use Case |
---|---|---|
|
|
|
|
|
|
|
These components act as a list and as a result, curly braces {} must be included around your values. In addition, the AnyIn and AllIn functions only work with Setup Data Checkbox, Setup Data Checkbox with Other, and Setup Multi-Select Components. |
|
Money |
|
|
Syntax
General syntax for expression statements include the following:
- The order of operations for Expressions follow the standard mathematical order of operations (i.e., Exponents, multiplication & division, and addition & subtraction).
- White space is ignored.
- The specific formats for referring to Risk Assess data, Survey and Workflow identifiers, and attributes are described below.
Punctuation
Punctuation is the set of symbols used to implement the grammatical structure of the syntax by separating or grouping.
Separators | Symbol | Use |
---|---|---|
Comma |
, |
Used for separating items in a list |
Double quotes |
" " |
Used for defining a string |
Backward slash |
\ |
Used to permit special characters such as “ (to use a string) or \ |
Groupings |
Symbol |
Use / example |
---|---|---|
Braces |
{ } |
Used for grouping list items (separated by commas) |
Parentheses |
( ) |
Used in functions and some specific statements |
Square brackets |
[ ] |
Used to refer to a specific survey section, question, response, KPI, or component |
Symbols |
Symbol |
Use / example |
---|---|---|
Question mark |
? |
Shortcut symbol used in if/then/else conditional statements to replace then |
Colon |
: |
Shortcut symbol used in if/then/else conditional statements to replace else |
Functions
A function is a pre-defined formula for performing calculations or executing commands on one or more parameters.
Defined Functions | Use Notes |
---|---|
COUNT |
Count items in a group |
MIN |
Minimum |
MAX |
Maximum |
AVERAGE |
Average |
SUM |
Sum |
MEDIAN |
Median |
STDDEV |
Standard deviation |
VARIANCE |
Variance |
DATEDIFF |
Date difference
To define the time unit, include one of the following in double quotation marks preceding the list of dates: days, months, years, quarters, weeks, hours, minutes |
DATE |
Date |
ISNULL |
Is null |
ISNOTNULL |
Is not null |
TODAY |
Today's date This is the date in Coordinated Universal Time (UTC) at the moment of the expression's execution. |
DATEADD |
Add to a date by day, month, or year Day: KPI[1.1].component["BasicCalendar"].value == DateAdd("d", 1, launch_date) |
DATESUB |
Subtract from a date by day, month, or year Day: KPI[1.1].component["BasicCalendar"].value == DateSub("d", 1, launch_date) |
Keywords
Keywords are defined words which cannot be used for any other purpose (e.g., these words cannot be used as variable names).
Defined keywords |
Use Notes |
---|---|
IF / THEN / ELSE |
|
IN |
|
NOT |
Can spell out “NOT” or use exclamation point (!) |
TRUE / FALSE |
|
AND |
Can spell out “AND” or use single ampersand (&) or double ampersand (&&) |
OR |
Can spell out “OR” or use single pipe (|) or double pipe (||) |
KPI |
|
COMPONENT |
|
VISIBILITY |
|
REQUIRED |
|
TEXT |
|
VALUE |
|
DATE |
|
MIN / MAX |
|
AVERAGE |
|
SUM |
|
MEDIAN |
|
STDDEV |
|
VARIANCE |
|
DATEDIFF |
|
ISNULL / ISNOTNULL |
|
MONTH |
|
Operators
Operators are designated symbols, words, or phrases used for checking, changing, or combining values.
Operators |
Use Notes |
---|---|
+ |
Add |
- |
Subtract |
* |
Multiply |
/ |
Divide |
! |
Use in front of an expression to indicate the inverse of the expression. Can spell out “NOT” or use exclamation point (!) |
> |
Greater than |
>= |
Greater than or equal to |
< |
Less than |
<= |
Less than or equal to |
== |
Is equal to Test of equality (conditional) |
!== ; != |
Is not equal to Test of inequality (conditional) |
AND & && |
Boolean operator (resolves to true or false) used with conditional expressions.
Can spell out “AND” or use single ampersand (&) or double ampersand (&&) |
OR | || |
Boolean operator (resolves to true or false) used with conditional expressions.
Can spell out “OR” or use single pipe (|) or double pipe (||) |
^ |
Power |
IN |
Determine whether a variable is included in a list. Must be followed by a list. |
!IN |
Not in a defined list |
= |
This is used to write assignment statements and cannot be used in an expression. Means “is.” This operator cannot be used in conditional expressions. |
NOT | Not |
ALLIN | All in |
ANYIN | Any in |
CONTAINSALL |
Contains all The CONTAINSALL operator determines whether a specified string or list of strings is present within a component or KPI with string values. This operator is not case sensitive. It does not matter whether a component or KPI is on the left or on the right of this operator. For example: “the quick red fox jumped over the lazy dog” ContainsAll KPI[1.1].component["product_description"].value |
Upgrade Impact
All programs created before this update will automatically migrate to the new conditionality format.
Previously, conditionality in a program allowed you to make additional questions appear depending on answers to specific yes/no questions.
In addition, you will now select KPI lines to show rather than hide.