For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create Formulaic CDT Fields

Overview

Mathematical expressions and formulas can be utilized within Custom Data Type Fields (CDTFs) to automatically calculate values or combine data from multiple fields. Formulaic fields can derive answers from two or more fields, perform mathematical calculations, or concatenate string values into a single result. These fields are useful for computing derived metrics, combining patient information, or calculating scores based on assessment answers.

Formulaic CDTFs can be associated with multiple Data Views, Assessments, Charts and Graphs throughout your Welkin environment.

Prerequisites

Before creating a formulaic custom data type field:

  1. Create a Custom Data Type (CDT) in Designer. For detailed instructions, see the Custom Data Types (CDT): Designer guide.

  2. Ensure you have the necessary data fields already created within the CDT that will be referenced in the formula.

Creating a Formulaic Field

Step 1: Set Up the Base CDT

  1. Log into Designer

  2. Navigate to Custom Data > Data Types

  3. Create or open an existing CDT

  4. Click + Data Field to add a new field to your CDT

Step 2: Configure the Field Type

When creating a formulaic field, set the field configuration as follows:

  1. Enter a Name for the field (lowercase, numbers, underscores, or hyphens)

  2. Set the Type to one of the following:

    • Formula – for mathematical calculations

    • Integer or Float – for numeric results

    • Text – for string concatenation results

Step 3: Create List Options with Numeric Values

If using a List field type that will feed into formulas:

  1. Set Type to "List"

  2. Set Value Type to "Integer" or "Float" to assign numeric values to each option

  3. In the Options field, add your answer choices and their corresponding point values

Example:

  • Question: "Did the patient meet their goal?"

  • Options:

    • Yes = 2 points

    • No = 1 point

    • Not assessed = 0 points

Step 4: Define the Formula Expression

  1. Select Type = "Formula"

  2. In the formula editor, you can:

    • Reference fields from the same CDT using field variable syntax

    • Perform calculations using operators (+, -, *, /, etc.)

    • Combine strings by referencing text fields

Formula Examples:

  • BMI Calculation: (weight_field / (height_field * height_field)) * 703

  • Age Calculation: Calculate years between two dates

  • Score Combination: field1_value + field2_value + field3_value

  • String Concatenation: first_name_field + " " + last_name_field

Step 5: Publish the Configuration

  1. Click Save to save your changes

  2. Click Publish to make the formulaic field available in Care and other visual components

  3. The formula will automatically calculate values whenever the referenced fields are updated

Using Formulaic Fields in Assessments and Data Views

Once your formulaic CDTF is created and published, you can:

  • Add to Assessments – Include the formulaic field in assessment forms to display calculated results

  • Display in Charts & Graphs – Visualize calculated data over time in line graphs, bar graphs, or pie charts

  • Reference in Automations – Trigger automations based on calculated values

  • Show in Patient Data Views – Display derived metrics in the Care portal patient profile

Best Practices

  • Test formulas thoroughly before publishing to ensure accuracy

  • Document formula logic in your naming conventions for team clarity

  • Use Integer or Float types for numeric calculations to ensure proper math operations

  • Reference only fields that will consistently have values to avoid null calculation errors

  • Keep formulas simple when possible for better performance and easier maintenance

  • Consider decimal precision when setting Float field types for currency or percentages

Limitations and Considerations

  • Formulas are recalculated automatically when source fields are updated

  • Circular references (where Field A depends on Field B, and Field B depends on Field A) are not supported

  • Formulas execute synchronously; very complex calculations may impact performance

  • Formula fields cannot reference fields from different CDTs (cross-CDT references are not supported)

Last updated

Was this helpful?