Expression

The Expression field in an assessment template allows you to specify an expression to define conditions for showing a specific text based on responses or parameters assigned to fields. The expression evaluates the conditions you define and determines which text to show. For example, you can specify an expression to assign risk levels based on the total score and determine the risk level text to show.

Using an expression, you can dynamically evaluate and present information based on the values obtained from specific fields, allowing for customized text to be shown.

Note 

How to use an expression to assign risk levels based on total score

This example shows how to use an Expression field to assign risk levels based on the total score obtained from Yes/No fields in a template. The expression used in the example uses an immediate if (iif) function to determine the risk level.

Suppose that your template contains the following fields:

You want to assign the risk level based on the sum of the scores of Q1 and Q2, as follows:

Then, you can use the Expression field to provide the following expression:

iif({totalScore} > 10, 'High Risk', iif({totalScore} > 5, 'Medium Risk', 'Low Risk'))

The outer iif function checks if the total score is greater than 10. If true, it returns High Risk. If false, it evaluates the second iif function.

The second iif function checks if the total score is greater than 5. If true, it returns Medium Risk. If false, it returns Low Risk.

Image of the Template Designer tab with the Expression section

Depending on the combination of responses to fields Q1 and Q2, the Expression field, which is named Risk in this example, shows the corresponding risk level text.

Image of the Test Template tab

How to use an expression to assign action levels based on responses

This example shows how to use an Expression field to assign action levels based on the responses to specific fields in a template. The expression used in the example uses an immediate if (iif) function to determine the action level.

Suppose that your template contains the following fields:

You want to assign the action level based on the responses to Q1 and Q1, as follows:

Then, you can use the Expression field to enter the following expression:

iif(({q1} contains 'biometric' or {q1} contains 'social') and {q2} contains 'item 2', 'Action Needed', 'No Action Needed')

The iif function checks if Q1 contains "biometric" or "social" and if Q2 is "Yes". If true, it returns Action Needed. If false, it returns No Action Needed.

Image of the Template Designer tab with the Expression section

Depending on the combination of responses to fields Q1 and Q2, the Expression field, which is named Action in this example, shows the corresponding action level text.

Image of the Test Template tab

Helpful resources

Tip For information about syntax rules, including various operands, operators, and functions, go to Expression Syntax.