This example will explain how to calculate a score based on the participant's responses using number fields and functions. The example below, will determine a safety score based on the responses to previous questions.
1. Add Select field(s) to capture the participant's responses.
2. Add a Calculated Value field to calculate (but not display) the score using the responses to the select fields added above. Use the dollar sign($) to reference the relevant fields in the calculation.
- Type in the formula as "=round((((int($safety_officer) + (int($fire_extinguisher) + (int($emergency_exit) + (int($evacuation_drills))))) div 20) * 100),2)"
- Select 'decimal' as the data type.
3. If you want to show the value of the calculation, add another field (e.g. an Information field) and reference the Calculated Value field name using the dollar character($) followed by the field name, e.g. $score.
Select the Preview button from the toolbar to test your calculation and see how it will be displayed when using the mobile app.
The calculated value can also be used as a source field to base skip logic on. For example, certain fields should only be asked if the total score is below 50%.