Validate data within nested structures

In Flowfinity, there are several ways of validating user data, including:

You can use state validation rules to prevent a record from being submitted based on other data in the same form. However, state validation rules do not allow you to directly validate data in nested structures. You can use the following method to prevent the user from submitting invalid data.

Example

In an inspection application, the inspector specifies the range of a pressure gauge used to take measurements. The inspector then makes a series of measurements. If any measurements are outside of the range of the gauge, the inspector is prevented from submitting the record.

Instructions

  1. In the Form section, select the nested structure field containing the values to be validated (e.g., Measurements List) and click on the Customize Nested Form link
    Flowfinity - Validate Data Within Nested Structures
  2. Create a new Numeric field. This field will indicate if the nested record contains an invalid value.
  3. Label the field appropriately (e.g., Measurement Invalid)
  4. Click on the 'Abc’ icon for the field, then select 'Formula Calculation’
    Flowfinity - Validate Data Within Nested Structures
  5. In the Formula box, specify a formula that returns a 1 if the nested list field is invalid, or 0 if the value is valid
    For example:
    (Measurement >= PressureGaugeMin AND Measurement <= PressureGaugeMax) ? 0 : 1)
    Flowfinity - Validate Data Within Nested Structures
    Note: For a complete list of available formula syntax, please consult the Flowfinity Actions Formula Field Syntax Documentation, or contact us for more information.
  6. Save the nested structure form
  7. Create a new field after the nested structure form
  8. Set the field type to 'Numeric’
  9. Label the field appropriate (e.g., AnyMeasurementInvalid)
  10. Change the field to a 'Formula Calculation’
  11. Specify a formula to sum the value of your invalid measurement check within the nested structure
    For example:
    SUM( MeasurementList.MeasurementInvalid )
    Flowfinity - Validate Data Within Nested Structures
  12. In the Operations section, determine the target state of the operation used to record measurements.
    Flowfinity - Validate Data Within Nested Structures
  13. In the States tab, select 'Edit state'
    Flowfinity - Validate Data Within Nested Structures
  14. In the Validation rules tab, click 'Add validation rules' to create a state validation rule
    Flowfinity - Validate Data Within Nested Structures
  15. Update the condition to indicate that that the field you created in step 8 must equal a constant value of 0
  16. Provide an appropriate error message.
    For example:
    One of your measurements is outside the range of your pressure gauge, please check your measurements, and retake any which fall outside the range of your gauge
    Flowfinity - Validate Data Within Nested Structures
  17. Publish the application