Default Value Expressions


Default Value expressions can be used to populate default values when an OpenGround Data Collector form is loaded.

Default Values can also be supplied as part of an 'Add Step' Action. Note the use of the source() function to utilize a value from the original Step as a default value in the Action Step:

Character Limit

Default Value expressions can contain a maximum of 3900 characters.

Examples

This expression sets the default value to B. This works well for pick list items:

'B'

This expression returns today’s Date with time set to midnight for a date time field:

Today()

This expression returns the number of records so far for this parent + 1.  Useful for sample reference numbers etc.

Count()+1

This expression returns the minimum value of previous records for this parent.  Header name is case sensitive and must be enclosed in single quotes.  Records are ordered by the Header by default:

min('DepthTop')

This expression returns the maximum value of previous records for this parent.  Header name is case sensitive and must be enclosed in single quotes.  Records are ordered by the Header by default.  Works well to set the top of a layer equal to the base of the last layer:

max('DepthBase')

Values from a parent record can be inserted as the default.  In this example, the Start Date will be the default value:

[LocationDetails.DateStart]

This expression returns the previous value used for the specified field. In this context, the 'previous' value refers to the value from the last existing record when the records are ordered in ascending order by depth-fields.

previous('DepthBase')

The previous() function will order records based on the first depth property by default. An additional parameter may be added to change what parameter the function uses to order the data. For example, the expression below will return the previous value when the records are ordered by DepthTop. Note - For the group 'BackfillDetails', the records will instead be ordered in descending order, so the least-deep record will be selected, as it is anticipated that the records will be entered from most-deep to least-deep. If this is not the desired behavior, then a second field-name can be specified (see example below) which will cause the existing records to be ordered by this second field in ascending order::

previous('DepthBase', 'DepthTop')

Please also see the Data Collector Profiles within our standard Configuration Packs for additional examples.

And please see this article for more information on other Data Collector expressions.