I've been playing around using a custom XForms client with ODK Aggregate, and noticed some behavior around the support (or lack of?) of the 'boolean' type for property bindings. That is, something like
... ...So I had my custom XForms client submit a variety of different values in the uploaded XML instance to try to determine what exactly ODK Aggregate expects to see for one of these 'boolean' properties. The results were:
'true' -> true
'false' -> false
'T' -> true
'F' -> false
'Y' -> true
'N' -> false
'yes' -> true
'no' -> false
'0' - > false
'1' -> false
and just for fun
'oui' -> false
'non' -> false
So it appears that ODK Aggregate does indeed recognize the 'boolean' type, in as much as it is clearly processing the corresponding data element as a boolean literal and inserting true or false in the database accordingly. Oddly, however, it does not seem to recognize '0' and '1' as legitimate boolean literals.
Note, if you subsequently fetch this submission from ODK Aggregate, you will always get 'true' or 'false' back in the XML instance. So, arguably, you really have to use 'true' and 'false' everywhere in your XForm when dealing with boolean elements, specifically when checking property values in XPath expressions (eg relevant="/data/yesorno = 'true'").
So my first question is can someone on the ODK Aggregate dev team confirm that yes in fact ODK Aggregate does support the 'boolean' data type, as I've described above?
I ask because it would appear that the client ODK Collect does not support a boolean type (!). Specifically, when presented with an XForm with a boolean element, the corresponding control is just presented as regular string input, into which you can type (and ODK Collect will accept) whatever text you type in (which will get shoved verbatim into the XML sent up to ODK Aggregate. So if, for example, you typed in "1" you'd actually be submitting false). Further, if you try to use the boolean data type in XLSForm the translation parser will throw an "unrecognized type" error. Which supports my conclusion that ODK COllect doesnt actually support booleans; rather it simply ignores the type and treats the binding as the default string type instead.
In summary, ODK Aggregate does appear to support boolean properties, but ODK Collect (and XLSForm) does not. Correct? [that seems very odd...]
- Gareth