I'm not sure if it is a bug or a design decision. We are on ODK Central 2023.4.0
When dowloading xml for submissions with API ({odk_host}/v1/projects/3/forms/my_form_name/submissions/{instanceID}.xml) values of fields that are empty for all submissions are missing.
For example, if I have two fields a and b, and some of the submissions have b empty it is fine and the xml will show both fields.
However if none of the submissions filled in b it is missing completely.
It is a problem when using a submissions from a complex form to create a schema for a database etc. The problem is not present when exporting to CSV.
I'm not sure what you mean by this if you are downloading individual XML files but also talking about a collection of multiple submissions.
values of fields that are empty for all submissions are missing.
If I understand correctly, you are saying that when downloading the XML directly for individual submissions, the fields that were empty are not present in the XML?
Central accepts XML submissions directly from Collect (or other clients) and doesn't change them at all. If an empty field is not shown in the XML, that is because the client did not add the empty tag for the empty field.
The reason the empty fields are shown even when they were empty in all submissions in a CSV export is because Central also knows the form schema and can build out that full table of data. But it is not doing that for single submissions when it is just returning the raw XML.
If you wanted to get complete data about an individual submission, you could potentially get it through the OData API? Hmm, I don't see how to do that, though. You can filter by multiple things but not the submission instance ID.
Silly me... Because of the way I'm creating a submission table after aggregating all xmls first, I'm only missing those that do not have value in any of the submissions. Thanks for pointing the obvious, and the super quick response.
This behaviour of course makes sense, and I've got confused with my own shortcuts.