Skip to content

Show more information when one of multiple entities in a repeat fails #1431

@ktuite

Description

@ktuite

In entities-from-repeats, you could have a submission that creates multiple entities, but if any one of the entities has an error, the entire submission processing will stop and none of the entities will be created.

Entity creation can fail when the label is blank, so one scenario in which this comes up is when the entity label is based on a field, and that field is not filled in.

Sample form:
conditionalrepeatwithgeopointent.xml

Steps to recreate:

  • Get form on Collect (with support for v2025.1 enabled)
  • Go to conditional reapeat with geopoint entties form.
  • In the first question select "yes"
  • Fill "child's name" and following questions.
  • Add another repeat but don't fill anything
  • Send the form
  • Check the list of entities

https://staging.getodk.cloud/projects/97/forms/conditionalrepeatwithgeopointent/submissions/uuid%3A5c1966d3-1932-4db6-99a1-d9121c9d7e92

No entities are created

Submission activity feed mentions blank label and nothing else

Image

XML of submission (with empty label field) looks like:

<?xml version="1.0"?>
<data xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:orx="http://openrosa.org/xforms" xmlns:entities="http://www.opendatakit.org/xforms/entities" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" id="conditionalrepeatwithgeopointent" version="1">
  <has_child>yes</has_child>
  <child_repeat>
    <nam>Bob</nam>
    <birthweight>25.0</birthweight>
    <geopoint/>
    <meta>
      <entity dataset="childRep" create="1" id="816af9fe-7b71-423d-b029-9141f70668d0">
        <label>Bob</label>
      </entity>
    </meta>
  </child_repeat>
  <child_repeat>
    <nam/>
    <birthweight/>
    <geopoint/>
    <meta>
      <entity dataset="childRep" create="1" id="2130e2b0-7288-476e-82ff-c4aa8c75a160">
        <label/>
      </entity>
    </meta>
  </child_repeat>
  <meta>
    <instanceID>uuid:c7b4f28e-e93d-48d1-acaa-3f918d60a812</instanceID>
  </meta>
</data>

What do we want to happen? It's easier to reject everything in the submission (and have the chance to edit the submission to fix it?) than to take some of the entities and not the others.

Here's an example of editing that submission to fix the error:
Image

Maybe the behavior is fine but there should be MORE information in an error message - like "2 entities detected, processed 1 of 2 before running into an error."

Metadata

Metadata

Assignees

Labels

backendRequires a change to the API serverbehavior verifiedBehavior has been manually verified

Type

No type

Projects

Status

✅ done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions