Dear ODK community,
we recently encountered some unexpected behaviour for ODK Central's OData and SubmissionXML APIs. Depending on whether relevant
was false for a group or field when filling in the form, they will be included or not included in inconsistent ways in the API responses. See below for the different cases.
The submission XML appearantly never includes groups or fields when they were not relevant. However, the OData submission response includes non-relevant fields with null-values but does not include non-relevant groups and their inner-fields.
What behaviour should be expected? From the OData API, we'd expect that all fields are always given, even if they were not relevant. This means that non-relevant groups would be included in responses, just like non-relevant normal fields already are.
Below you can find sample responses and an XlsForm to reproduce.
Thanks for you thoughts!
Best,
Vitus
Addition: We noticed the issue because the behaviour was different on ODK Aggregate, if I remember correctly. In ODK Aggregate's JSON publishing mechanism, all fields were always included, independent of whether they were relevant or not.
OData responses with different relevant-options:
{
"value": [
{
"__id": "uuid:38c44ef9-1b4f-4305-8b06-9a525520b604",
"show_group": "yes",
"show_field": "yes",
"number": null,
"__system": {},
"group": {
"inner_number": null
},
"meta": {
"instanceID": "uuid:38c44ef9-1b4f-4305-8b06-9a525520b604"
}
},
{
"__id": "uuid:f77aa888-8cfd-4695-b261-292333477106",
"show_group": "yes",
"show_field": "no",
"number": null,
"__system": {},
"group": {
"inner_number": null
},
"meta": {
"instanceID": "uuid:f77aa888-8cfd-4695-b261-292333477106"
}
},
{
"__id": "uuid:30f81702-0967-4e6f-bf97-383f7e4221c8",
"show_group": "no",
"show_field": "no",
"number": null,
"__system": {},
"meta": {
"instanceID": "uuid:30f81702-0967-4e6f-bf97-383f7e4221c8"
}
}
],
"@odata.context": "https://example.com/v1/projects/4/forms/field_conditions_minimal_dv2.svc/$metadata#Submissions",
"@odata.count": 3
}
Different Submission XMLs:
<!-- group is relevant, field is not-->
<data xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" id="field_conditions_minimal_dv2" version="1">
<show_group>yes</show_group>
<show_field>no</show_field>
<group>
<inner_number/>
</group>
<meta>
<instanceID>uuid:f77aa888-8cfd-4695-b261-292333477106</instanceID>
</meta>
</data>
<!-- group and field are not relevant-->
<data xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" id="field_conditions_minimal_dv2" version="1">
<show_group>no</show_group>
<show_field>no</show_field>
<meta>
<instanceID>uuid:30f81702-0967-4e6f-bf97-383f7e4221c8</instanceID>
</meta>
</data>
<!-- group and field are relevant-->
<data xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" id="field_conditions_minimal_dv2" version="1">
<show_group>yes</show_group>
<show_field>yes</show_field>
<group>
<inner_number/>
</group>
<number/>
<meta>
<instanceID>uuid:38c44ef9-1b4f-4305-8b06-9a525520b604</instanceID>
</meta>
</data>
XlsForm:
central_nullvalues.xlsx (12.4 KB)