**Introduction**

The GoFormz **Calculation Builder** gives template builders a dedicated, comprehensive, and dynamic space to learn, build, and test their calculations in the Template Editor.

### Where can I use the Calculation Builder?

The **Calculation Builder **is used in several places throughout the **Template Editor**. Essentially, anywhere you can utilize our powerful calculation engine, you will be able to use the Calculation Builder to craft your formula. This includes:

Default Value property

Database Filter property

Formatting property

Custom Calculations for Display Properties (Color, Background, Visible)

Dynamic Field Properties such as Required, Visible, Color, and Background

Default Form Name

### Building a Formula using the Calculation Builder

To open the Calculation Builder, simply select a field you would like to edit and click on one of the properties listed above.

Note that some properties also support plain text as a value. For example, the Default Value property can be a simple string of text that is meant to show in a field when a form is created OR can be a calculated value using a formula.

For these properties, you will still use the Calculation Builder but will be given an option in the text area to type your plain text OR start with a "=" to build a formula.

For the below example we will assume that we are building a formula in the Default Value property of a Text Field.

In the Template Editor, select your field and navigate to the Properties panel. Click on the Default Value property to open the Calculation Builder.

Once the calculation builder is opened, start your calculation by typing an =.

A full list of the available Functions, Environment Variables, and Fields available in the GoFormz Calculation Engine will appear to the left in the builder. You can hover over each function, variable, or field to see a description, example, and further documentation of each in the space on the right.

To add a function to your calculator either click on the function you would like to add OR start typing to add your function components manually.

As you type your calculation, you will notice the list on the left will truncate to only show the matching or available functions, variables, and fields that work within your current formula.

For example, in the calculation below, we would like to reference a field (represented within [ ] brackets) with the name Checkbox 17. As the name of the field is typed into the calculation, the list of matching fields on my template will show as available to be selected.

### Validating Your Formula

As you write your formula, you will notice a few areas where the Calculation Builder validates the accuracy of your calculation. These areas are meant to highlight potential errors or missing elements in your formula before you save your work.

**Done Button**: If your calculation contains errors or is not yet complete, the Done button will show as Red in the top right corner.**Validation Text**: If there is an error in the syntax of your formula, the text in the bottom right corner of the builder will help provide context to what error may be and how to fix it. In the example above, you will see that the falseValue component is missing an ending ".

Note: Invalid calculations or formulas with identified errors can still be saved to a field. However, they will still show as errors in the Calculation Builder and the **Template Validation** tool beneath your Template Name.

### Testing Your Formula

The Calculation Builder makes it easy to test your formula before saving it to the field. Once you have a completed formula, select the** Test Formula **option in the bottom right corner of the builder.

This will open a test environment that includes any fields referenced in your formula.

Interact with your fields (dependencies) to observe the results your formula will produce. If you need to edit your formula, you can type directly into the calculation or click **Edit Formula** to switch back to the Calculation Builder view.

### Saving your Calculation

Once you are ready to save your calculation, simply** click the Done button** in the top right corner or **press the Enter key** on your keyboard.

**Note**: Clicking off or away from the Calculation Builder will **NOT** save your current changes. You must select the Done button or press enter to save any changes to this property.

**Related Articles **