Calculation fields can be used to write simple expressions to calculate values dynamically based on inputs given to other fields in your forms. This can be simple ‘total’ calculations or complex equations referencing other calculation fields and even data contained in repeatable sections.
As seen in the example video below, when you build an expression using a calculated field, you have access to all of your form field values from within the expression builder tool for driving calculations. There’s an extensive library of searchable functions, most of which you’ll recognize if you’re familiar with building formulas in spreadsheets like Excel or Google Sheets. Also included are several functions that are Fulcrum data-specific, giving you the ability to include in your calculations your record’s status, latitude or longitude, and more.
A few example use cases could be:
Calculation of dimensions, areas, and volumes for site surveys
Determining totals for supply and inventory applications
Weighting and averaging for dynamic scoring
Displaying summary text with concatenation
Expressions
You can view our currently available functions on our developer pages.
For users wanting to calculate more complex results from their data, calculated field's code editor can leverage raw JavaScript. This means you can write complex functions (and entire programs) to return results out of user-entered data on-the-fly.
Display Formats
You must select a format for displaying the expression result.
Text - Use this for displaying text or unknown values.
Number - Use this only for displaying numeric values.
Date - Use this for displaying formatted date values. The value should be in the following format:
YYYY-MM-DD
.Currency - Use this for displaying formatted currency values. The value should be a number and you'll need to select a specific currency.
Helpful Hints
Having trouble writing your expression? Maybe some of these tips will help:
Code Text Field and eval Calculation Field
This is a neat way to test expressions on a mobile device on-the-fly:
Add a text field to your form. This is where you’ll enter your javascript.
Add a calculation field to your form. Set the expression for this field to
eval($code_field_data_name)
.Sync your mobile device, and now you can type code into the text field. You’ll see the result work in the eval field!
INSPECT()
The INSPECT()
function can be used to check the value being produced by a variable.
Console.log()
console.log()
can be used to display values in the developer's console in the web browser while troubleshooting your code.
Note: console.log()
will need to be removed once you have completed troubleshooting. Failure to remove the console.log() from your code will result in issues on the Fulcrum mobile apps.