CORE MODULE

Creating Calculated Fields

What you'll learn in this guide

Learn how to create calculated fields in a form, including common use cases and how to apply calculations to support more dynamic data capture.

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

  1. Drag the Expression (read-only) component into your form.
  2. 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.

  1. Add in the Expression (read-only) option from the toolbox.
  2. Click Edit‍
  3. Enter the expression
    • In this case we want to populate the field with the case type that will come from this form response.
  4. 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.

‍

‍