Copyright © 2019 EarthSoft, Inc • Modified: 04 Mar 2019
Formulas are created using the Formula Builder. A new formula can be created by clicking on the + button to add a formula component. Choose what type of formula to build by selecting the desired component tab.
Value – The actual value attributed to a field. Values may be numeric (start with a number) or a string (start with a quote). Some field values, for example a geography field, have string representations that are in JSON format. To enter an empty/blank value, select the empty box on the right-hand side. The formula parser will add an empty string value of '' to the formula.
Function – A list of all functions available to be used in building formulas, described in detail in the Function Descriptions article.
Fields – This tab provides access to form fields on the current form or a parent form as well as meta data. Fields are grouped by Standard Fields and Section Fields, which refers to general, universal fields that are not restricted to fields on the form (e.g., the date/time the form was started).
Aggregate Fields – Refers to fields inside aggregate functions, which process all values of fields on specific tables. Aggregate functions and fields allow the extraction of data from other tables and executing more complex validation tasks. For example, a user can determine if a measured value is stable (has not changed much over the last three readings) or can extract a value from a related form.
Snippets – This tab allows the user to save a formula to use in another field or on other forms, described in detail in the Formula Snippets article.
Test – This tab allows for testing various pieces of a formula by entering test values. Note that for complete testing of formulas, the template can be set to test mode and downloaded on the device.
Note: Fields with Default attribute values are required to be visible for the formula to properly function. For formula(s) to work with a hidden field(s), the field(s) must be a formula or pre-populated field.
The fields shown in the Fields section of Formula Builder correspond to fields added to the form template, as designed in the Template Designer. The fields are organized by the forms to which they belong. In this example, the BoringLog2 template has three parent forms: Project, Boring, and Test Pits. The Boring form is a parent form with six child forms.
The image below shows the Boring form and its associated fields.
The Fields tab displays the standard fields and section fields (i.e., system fields) that belong to the form currently being configured. In this example, the fields relate to the Boring form and its associated child forms.
While still in the Formula Builder, fields from all other forms in the template can be accessed by selecting the Aggregate Fields tab.