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 fields. You can use the following method to prevent the user from submitting invalid data.

Example

In an inspection application, the inspector is using a particular pressure gauge used to take measurements. The pressure gauge range is copied into the form through a lookup. If any measurements are outside of the range, the inspector made an invalid measurement is prevented from submitting the record.

Mobile Paperless Inspection Form

Instructions

  1. In the Form section, select the nested 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., Invalid Measurement).
  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. To easily show the user that the measurement is invalid, you can also add color rules to the nested field, such as coloring the field red. Click on the top bar of the nested field, and click 'Add color rule.'
    Flowfinity - Validate Data Within Nested Structures
  7. Create the conditions under which the field should be colored.
    Flowfinity - Validate Data Within Nested Structures
  8. Save the nested field.
  9. Create a new field after the nested field.
  10. Set the field type to 'Numeric.’
  11. Label the field appropriate (e.g., Invalid Measurements Total).
  12. Change the field to a 'Formula Calculation.’
  13. Specify a formula to sum the value of your invalid measurement check within the nested structure
    For example:
    SUM( MeasurementsList.InvalidMeasurement )
    Flowfinity - Validate Data Within Nested Structures
  14. In the Operations section, determine the target state of the operation used to record measurements.
    Flowfinity - Validate Data Within Nested Structures
    Flowfinity - Validate Data Within Nested Structures
  15. In the States tab, select 'Edit state.'
    Flowfinity - Validate Data Within Nested Structures
  16. In the Validation rules tab, click 'Add validation rules' to create a state validation rule.
    Flowfinity - Validate Data Within Nested Structures
  17. Update the condition to indicate that that the field you created in step 8 must equal a constant value of 0.
  18. 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 correct range.
    Flowfinity - Validate Data Within Nested Structures
  19. Publish the application.