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:
Create a Custom Data Type (CDT) in Designer. For detailed instructions, see the Custom Data Types (CDT): Designer guide.
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
Log into Designer
Navigate to Custom Data > Data Types
Create or open an existing CDT
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:
Enter a Name for the field (lowercase, numbers, underscores, or hyphens)
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:
Set Type to "List"
Set Value Type to "Integer" or "Float" to assign numeric values to each option
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
Select Type = "Formula"
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)) * 703Age Calculation: Calculate years between two dates
Score Combination:
field1_value + field2_value + field3_valueString Concatenation:
first_name_field + " " + last_name_field
Step 5: Publish the Configuration
Click Save to save your changes
Click Publish to make the formulaic field available in Care and other visual components
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)
Related Topics
Custom Data Types (CDT): Designer – Creating and managing CDTs
Custom Field Types – Reusable field type templates
Charts & Graphs: How to Configure – Displaying calculated data visually
How to Add Conditionality to Assessments – Conditional logic in forms
Designer: Feature Overview – Custom Data Types – General CDT overview
Last updated
Was this helpful?