Toolbox Components for Calculated Fields
Expression (read-only):
- This control, available in the form builder toolbox, calculates values automatically based on your formula.
- It displays the result to users but does not allow manual input.
Expression Language Syntax
The Chandler CX Platform uses a straightforward, form-specific expression language for calculated fields
Field referencing: Use curly brackets to reference other question values, for example:
{question1} + {question2}
Mathematical operations: You can add, subtract, multiply, divide, and group calculations, for example:
({price} * {quantity}) * (100 - {discount})
Built-in functions:
Conditional logic:
iif(condition, value_if_true, value_if_false)
Current date:
today()
Calculate age from a date:
age()
For common aggregates and calculations:
min()
max()
count()
avg()
For example, this will display "High" if the score is above 80, and "Low" otherwise:
iif({score} > 80, "High", "Low")
This language is designed to be simple and readable, allowing form designers to build calculations without traditional programming.
How to Create a Calculated Field
Add the Expression Field
- Drag the Expression (read-only) component into your form.
- Click Edit
Input Your Formula
Configure the expression with your calculation, referencing other field names inside curly brackets and using available functions as needed.
Scroll down to see how you can customise how the result is displayed.
Test and Preview
Test the form to confirm your calculation works as expected.
Advanced Logic (Optional)
Use the form logic builder to trigger calculations only under certain conditions or to run more complex expressions, see the article Form Logic.
Example:
Start with a question where the user will choose what kind of application they need from the drop down.
We will set up calculated fields based on this question and answer.
- Add in the Expression (read-only) option from the toolbox.
- Click Edit
- Enter the expression
- In this case we want to populate the field with the case type that will come from this form response.
- Click OK
iif({documentType} == 'New super application', 'Member - Create', iif({documentType} == 'New pension application', 'Pension Shell Account – Create', iif({documentType} == 'Other', 'Correspondence – General (Adviser)', '')))
Apply form logic if required
Then use form logic to make this question invisible to the user, but it will be visible in the response, so when connected to a core platform, it will create a case with that case type specified.
Please contact ChandlerCX support if you need help with complex expressions or logic.