ENGAGE HELP CENTER
Calculated answers
This page will serve as a guide to setting up calculations in the surveys to be able to apply them in drawing valuable analytical conclusions and creating conditional reports to the participants.
Calculated answers is a helpful tool for drawing invaluable insights from the submitted survey responses. This feature supports both creating underlying calculations based on the responses given in the survey, visible only to the administrators when exporting and analysing the survey response data, as well as preparing calculation-based participant reports that will help tailor and personalise the message displayed to the participants.

Use cases
Among countless other options, here are some examples of well-known health-related risk calculation models and index calculations that can be set up within the Engage surveys with help of the new Calculated answers functionality:
- Body Mass Index calculation,
- SCORE2, SCORE 2-OP CVD risk calculation,
- Breast cancer risk calculation,
- EQ-5D standardised calculation of health-related quality of life,
- Patient-reported outcome measure (PROM) scores,
- etc.
Developing calculations
The administrators can choose to build equations using the user-friendly Calculation builder or opt for developing the necessary calculations with help of the JSON builder.

New calculation

The option New calculation will open a new blank calculation builder view that will have to be developed following the below steps.

1. Insert the Title of the calculation to be able to easily recognize it in the further steps of developing the survey in case multiple calculations are planned.
All new calculations are assigned the default title "My expression".
2. If necessary, in the expandable section Constants/Questions with help of the available equation templates add constant values or the values that will be provided by the participants as answers to specific questions of the survey.
The section of the available equation templates is expanded after selecting the default value "1" in the Constants/Questions or Calculation builder field.
3. In the section Calculation following the logic sequence of building equations and with help of the available equation templates, put together the necessary equation. All the changes made in the calculation builder are auto-saved.
Supported constructs
Multiple different calculation constructs are currently supported by Engage.

- Add (ie., Sum) - use to summarize two numbers.
- Subtract - use to subtract one number from another.
- Multiply - use to multiply two numbers.
- Divide - use to divide one number by another.
- Negate - use to determine what is the opposite value of the given number.
- Power - use to multiply the number by itself a specific number of times.
- Root - use to find the root of a number.
- Sqrt - use to find the square root of a number.
- Square - use to find the squared value of a number.
Here are some simple examples how these equations have been applied.

["Power", 2, 3]                   # 2^3=8
["Root", 9, 2]                    # √9=3.0
["Root", 8, 3]                    # ∛8=2.0
["Sqrt", 9]                       # √9=3.0
["Square", 4]                     # 4^2=16
This is how calculations are displayed when developed with help of JSON editor.
- Exp - use to calculate exponential functions.
- Log - use to return the natural logarithm of a number.
- Log2 - use to return the base-2 logarithm of a number.
- Log10 - use to return the base-10 logarithm of a number.
This is how calculations are displayed when developed with help of JSON editor.

["Exp", 2]                        # e^2≅7.389
["Log", 2.7183]                   # ln(2.7183)≅1.0000
["Log2", 8]                       # log2(8)=3.0
["Log10", 1000]                   # log10(1000)=3.0
- Round - use to return a decimal number rounded to the specified number of decimal places.
Here are some simple examples how these equations have been applied.

["Round", -5.123456, 2]           # -5.12
["Round", -5.123456, 0]           # -5.0
["Round", -5.123456]              # -5
Comparisons
Comparison operators can be used to compare two values and return either the value True or False based on whether the condition has been met. They serve as supportive operators for such additional constructs as If-statements and Switch-Case statements.

- Equal - use to check if the values on either side of the operator are equal.
- Greater - use to check if the value on the left is greater than the value on the right.
- GreaterEqual - use to check if the value on the left is greater than or equal to the value on the right.
- Less - use to check if the value on the left is lesser than the value on the right.
- LessEqual - use to check if the value on the left is either less than or equal to the value on the right.
- NotEqual - use to check if the values on either side of the operator are unequal.
Aggregation
Aggregation functions will be useful when it is necessary to perform a calculation on a certain value set in order to returns a single value.

- Max - use to return the maximum value of a set.
- Min - use to return the minimum value of a set.
- Average - use to return the average value of a set.
- Median - use to return the middle value of a set.
- Length - use to return the length of a set, for example, to return the number of items in a list.
- Any - use to evaluate items in a set and determine which are true. If any item on the list is true, the function will return the answer True. Otherwise the answer will be False.
- All - use to evaluate items in a set and determine which are true. If all items on the list are true, the function will return the answer True. Otherwise the answer will be False.
Typecasting
Typecasting functions can be used to convert a variable value from one type to another.

- Int - use to convert the specified value into an integer number.
- Float - use to convert the specified value into a decimal number or fractional form.
Additional constructs
Engage supports several additional constructs.

- Constants can be defined in the section Constants/Questions and used in calculations, as well. This construct consists of the defined Constants that can be included in any of the available equation templates with help of the construct Constant or Question.
- If-statements can be used to return numeric values based on logic expressions. Here is a simple example on how if statements can be built.
- Switch-Case statements can be used to execute different kind of scenarios based on a variable. For example, with this construct it is possible to return a numeric value based on a textual input given in the survey answers.
After the necessary calculations have been developed, it will be possible to apply them in the Conditional reports section and view them in the Engage Analytics tool and data export files.