Update csv file automatically with input from the current survey

1. What is the problem? Be very detailed.
I'm using a choice list of household members in a separate csv file through the search() function in the appearance column of my xls form.
A question in my survey where choice list is searched is : If a household member died after the minicensus, select the household member.
A subsequent question which also search through the choice list of household members says: Select household member to inject.

Now my question
If a household member is selected as dead in first question, is there a way in ODK to automatically update csv (remove dead member from csv) so that in subsequent question the choice list pulled through the search() function doesn't contain the dead member?

It's not possible to update a csv file but it should be possible to filter you choices so that in the second question you get only those not selected in the first one. If you used normal (not external) choices the form would be similar to https://docs.google.com/spreadsheets/d/1WUBl7BV_K3EwDAGFRgAxRUnVaGdg3pzO/edit?usp=sharing&ouid=113855100722173642692&rtpof=true&sd=true you would just need to wrap selected(${q1},name) with not()...

However you are using external choices with search() function. That function supports four search types:

  • contains
  • matches
  • startsWith
  • endsWith

more info: https://www.youtube.com/watch?v=eEXa8GK4yE4

in your case you would need something like not_matches which is not supported...

The last option would be using External selects in the same way I described in the first case (internal choices) but apparently there is something wrong with choice_filter there what I reported: https://github.com/getodk/collect/issues/4795

Is your set of choices huge? Because at the moment the only working solution I can think of is using internal choices (case 1).

1 Like