Missing field when retrieving submission via API after it's edited

Description

We have a form in which we collect data from participants. In this form they need, among other things, to fill in the size of their location and how this is used. They can select the types from a multiple select and for each selected item they need to fill in the size of the surface that is used. There is a constraint on this last field which states that the surface is larger than 50 m2 and smaller than the total size (example below).

We collect the submissions via the API. When a mistake was made, the user can update their submission and hit a button to recollect the submission. However, if the user does not change the selected items in the multi select or updated the surface, then the surface field for each item is missing when downloading the submission via the API.
the field with the constraint is missing after the update.

Example: A participant can fill in that their location is 14000 m2. On this location, there are plants of type A and B. A takes 5000m2 and B takes 6000m2.

Steps to Reproduce

  1. Create a form with the following questions:
    • Some question (type unimportant)
    • Total surface (type: Decimal)
    • Entities (type: Multi-select)
    • Surface entity (for each selected item) (type Decimal)
  2. The last question has the following constraint: .>=50 and .<=${total_surface}
  3. Save the form
  4. Enter a submission
  5. Edit the submission by updating the first question
  6. Retrieve the submission via the API

Expected behavior

Every answer is included in the retrieved submission

Actual behavior

The answers for Surface entity is missing

Additional details

Your environment, why you think this might be happening, or stuff you tried that didn’t work


- What should topics in this category generally contain?

- Do we need this category? Can we merge with another category, or subcategory?

Welcome to the community, @dennis_buijsman! Could you kindly share a screenshot of what is missing? Do you see that data under the DATA>Table View?

I checked the Table View and it does not show any data for that field for any submission, even though that it is filled in some submission.

We took a deeper dive into the data that we retrieve from the Kobo API and we discovered that the problems lie with calculated fields.
The json of a submission contains a list of crops. Each crop can have a list of varieties, but some crops do not have any variety.
The initial submission for a crop without varieties does not contain the list property for varieties as shown in this picture:

If we edit the submission and retrieve the submission again from the Kobo API, then the same crops suddenly contains the list property with a single entry. This entry contains some calculated values even though that we did not change any value that is relevant for these calculated values. The same part of the crop after editing suddenly looks like:

All the values in this new entry are "0" or "NaN" even though that these values are not allowed when they are filled for a crop with varieties