When should I use a formula?
Formulas are essential for cases where the form needs to adapt in real-time, such as calculating totals, validating data, or displaying specific sections depending on what the user selects. They allow you to automate processes like routing tasks to the right individuals, enforcing rules (such as making sure fields meet certain criteria), or generating custom outputs based on a combination of factors.
Essentially, a formula is your go-to tool when you want the form to do more than just collect information; it enables you to create intelligent, interactive workflows that save time and reduce errors.
Some common uses:
Automatically assigning approvers based on rules and conditions
Determine if a notification should send based on rules and conditions
First, A Quick Word About Component IDs
You’ll often reference component IDs when creating formulas.
For example, if you have an input component that collects the number of students attending a field trip (Component ID: studentCount), you can use this ID directly in your formula. If you're collecting staff member details in another field (staffCount), you'll use these IDs to build your logic.
Second, A Note About Droplet AI
Before we jump into learning how to write a formula expression, the easiest way to do it is to rely on Droplet AI for assistance!
Here's how:
Droplet AI can be used anywhere you can type a formula. For example, in the Form Editor, select a component and click Validate Logic from the properties panel.
In the top pink bar, type the validation conditions you would like to apply to this field in plain wording, for example: "must be less than $200."
Press enter and await a response from Droplet AI. Accept its recommendation by clicking the Accept icon or by pressing Done.
Use the following building blocks to help you write your own formulas:
Simple Math
Adds numbers together
Subtracts one number from another.
Multiplies numbers.
Divides numbers.
Comparisons
Comparison operators (or conditional operators) are your form's decision-makers! They let you check whether values meet specific criteria, helping your form react to user input with true/false logic.
Checks if two values are the same.
You can also use:
field1 === field2
Checks if two values are different.
You can also use:
field1 !== field2
Verifies that a value falls between a minimum and maximum range
Confirms that one number is greater than another
You can also use:
value > comparison
Confirms that one number is greater than or equal to another
You can also use:
value >= comparison
Ensures that one number is smaller than another
You can also use:
value < comparison
The value must be less than or equal to a specific number
You can also use:
value <= comparison
Checks if a value is part of a specific list
You can also use:
[list].includes(value)
Of course, we'd recommend just using a dropdown, radio button, or checkbox to narrow choices like this!
Logical Operators
Ensures that all conditions are true
You can also use:
condition 1 && condition 2
Allows for at least one condition to be true
You can also use:
condition 1 || condition 2
To Use Within Other Helper Functions
Marks the field as not required
To make a field optional, just turn off the Required switch in the field’s properties panel. However, if you need to make a field optional based on certain conditions, you can use this helper function.
The first test is "Is Next Action equal to Approve?" If so, this will require a value in the field. Otherwise, it will make it optional.
This tells you how many characters are in a value. For lists, it will tell you how many items are in the list.
Great for ID numbers and account codes!
Converts a number into a formatted currency string, like turning 5 into $5.00
This is especially helpful when used with other helper functions, if you need to format a number as currency.
Converts a currency string back to a number, like turning $5.00 into 5
This is especially helpful when used with other helper functions, if you need to format a currency value as a number first.
If-Else Operator
Checks if an expression is true or false and returns a certain value in either case.
Also called:
ternary operator
You can nest a few If-Else statements together to create a string of different conditions. For example:
Other Popular Helper Functions
Returns the ID of the submission's current workflow step
Returns the submitter's name
Returns the submitter's email
In tables, this references the value of a column in the current row
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article