Validation Expressions can be used in OpenGround Data Collector to perform automatic checks on the collected data.
Validation Expressions need to be written as Boolean (True/False) conditions. If the condition returns True, the data is considered valid. Validation Expressions are executed when the user saves the data for a Step. If the condition returns False, the data is considered invalid and an Error or Warning is raised. Errors will prevent the data from being saved. Warnings will raise a message, but the data can still be saved.
Calculated Value expressions can contain a maximum of 255 characters.
Header | Validation Expression | Message (displayed when Validation Expression returns False) |
Sample Base | [DepthBase]>=[DepthTop] | 'Incorrect Depths. Base depth must be greater than or equal to top depth' |
Sample Base | [DepthBase]>=0 | 'Incorrect base depth. Value must be greater than or equal to 0' |
Date Time Sampled | [DateTimeSampled]>[LocationDetails.DateStart] | 'Incorrect Date. This location was started on ' + [LocationDetails.DateStart] |
Hand Penetrometer | isnumber([HandPenetrometer]) | 'Value is not numeric. Are you sure this is correct?' |
Date Test | [DateTest]<Now() | 'Test date cannot be in the future!' |
Depth Base | not(isnull([DepthBase])) | 'Warning: No depth base has been recorded' |
Origin1 | in([Origin1],'igneous','sedimentary) | 'Error: Origin entered does not equal igneous or sedimentary' |
Origin1 | ([Type]='Y' and in([Origin1], 'sedimentary','metamorphic','igneous', 'rock')) or [Type]='N' and in([Origin1], 'fill') | 'Origin is not valid'. |
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.