In Way We Do Forms & Registers, you are able to use Formula fields to combine values, fields, or formulas together and create a single value output.
By referencing the data already entered into your forms, you are able to build Expressions using Functions and Operators to calculate a single value output automatically.
Whether you are calculating a total cost, determining a risk score, or setting a due date, Way We Do provides a range of functions, operators, data types, date and time formats, numeric formats, and other options to help you customize your workflows.
Here is a breakdown of the core components you will use when building formulas.
What are expressions?
An expression is the complete "sentence" of code that you enter into a formula field. It is the combination of all your fields, numbers, operators, and functions working together to produce your final result.
Example: `(Item Price * Quantity) + Tax Amount` is a complete expression.
How do you reference Form Fields in an expression?
To use data entered into your Form in your formula, you need to reference that field's title. In Way We Do, we use the Field Reference Symbol ($) to tell the system that you are calling a field.
Simply type the $ followed immediately by the exact name of your column or field.
Example: To multiply the price by the quantity, your expression would look like this: $Price * $Quantity
What are operators?
Operators are the basic symbols used to perform standard math or make comparisons between different pieces of data in your expression.
Math Operators include symbols like `+` (Add), `-` (Subtract), `*` (Multiply), and `/` (Divide).
Logical Operators include symbols like `=` (Equals), `>` (Greater than), and `<` (Less than).
Example in a formula: Subtotal + Tax Amount - Discount
What are functions?
Functions are pre-built commands designed to perform specific, often complex calculations automatically. Instead of manually typing out long math equations, functions act as shortcuts. You simply provide the function with the data it needs, and it does the heavy lifting behind the scenes.
Math Functions: SUM() (Adds everything in the list), AVERAGE() (Finds the average from a set of numbers)
Text/Logic Functions: IF() (Checks if something is true or false)
Example in a formula: SUM(Subtotal, Tax Amount, Shipping Fee, Rush Fee)
Notice how much faster this is than typing Subtotal + Tax Amount + Shipping Fee + Rush Fee.
The `SUM()` function automatically adds together all the fields you place inside the parentheses, rather than you having to place a `+` between every single item.
What are data types?
Data types refer to the kind of information your formula is reading or producing. Formulas handle different data types in different ways (for example, you can multiply Numbers, but you cannot multiply Text). The main data types include:
Numbers: Standard numerical values (e.g., 10, 4.5, -3).
Text (Strings): Words or characters, which must usually be wrapped in quotation marks (e.g., "Pass", "Fail").
Booleans: A simple logic state that is either `True` or `False`.
Dates/Time: Specific calendar dates and times.
What are date and time formats?
When working with Dates and Times in formulas, you can manipulate timeframes -- such as calculating the number of days between a "Start Date" and an "End Date," or automatically adding 30 days to today's date for an invoice deadline. Date and time formats allow you to control exactly how that resulting date is displayed on your form (e.g., `DD/MM/YYYY` vs `MM/DD/YYYY`).
What are numeric formats?
Numeric formats control the visual appearance of your formula's final number output. While the background calculation remains the same, you can format the final result to display as:
Percentage: Converts the number to a percent (e.g., 15%).
Decimals: Controls how many decimal places are shown (e.g., rounding to 2 decimal places).
Trailing: Simplifies massive number into thousands or millions. (e.g., automatically displaying $1,500,000 as just 1.5 so you can label it 1.5M).
What are the miscellaneous options?
Way We Do also supports a variety of advanced options and background rules for how your formulas are processed to ensure accurate results. These include:
OverflowProtection: To protect the integrity of your data, the system will intentionally throw an error if a numerical calculation produces a value that is too large for the data type to handle (an overflow).
NoStringTypeCoercion: When you use the addition operator (`+`), the system will not automatically convert text strings into numbers. If you need to add a string as a number, you must explicitly use the `Number()` function to convert it first. *(Note: Other mathematical operators like minus, as well as specific function parameters, can automatically coerce strings into numbers).*
DecimalAsDefault: To prevent unexpected rounding errors -- which is especially important for financial calculations -- the system defaults to using a "decimal" data type rather than a "double" data type when calculating floating-point values (numbers with decimal points).
