Retrieving multiple_select values via API

Hi,

we've created a form that contains a number of multiple select widgets. We are retrieveing the submission data via the API

and have noticed that the values selected for the multiple select widgets are being returned as a space delimited string.

Is there any way to retrieve the individual values via the API, or will we need to split the string once we have retrieved via the API?

Thanks,

Enda

Hi,

we've created a form that contains a number of multiple select widgets. We are retrieveing the submission data via the OData API using ruODK
https://docs.getodk.org/central-submissions/#downloading-submissions-with-python-r-and-more

and have noticed that the values selected for the multiple select widgets are being returned as a space delimited string.

Is there any way to retrieve the individual values via the API, or will we need to split the string once we have retrieved via the API?

Thanks,

Enda

You'll have to split the string. If you are using ruODK, perhaps @Florian_May can add a convenience method?

@yanokwa is correct, you'll want to split the string by whitespace.

tidyr::separate_rows() does a fantastic job to split single rows with multiple values in one column into separate rows with single values in that column. See here for an example, where separating rows is one of several post-processing tasks in the "ODK to downstream format" transformation step of an ETL pipeline.

I've left this out of scope of ruODK so far for a couple of reasons:

  • Separating rows is a one-line statement. There's not much efficiency to be gained by wrapping (and obscuring) a clean tidyverse function into an ruODK function parameter or a separate ruODK function.
  • The desired output format could be more varied than e.g. geolines or geoshapes where a defined outcome format is desirable and ruODK provides non-trivial convenience helpers.
2 Likes