1. What is the problem? Be very detailed.
For a Service Provision Assessment study, I would like to use the last-saved value as a dynamic default so that the data collector does not have to reenter the district and facility when they are conducting research in the same place.
As the study is multi-country and I want to keep the XLSForms as standard as possible between countries, I am using CSV files to store all variables that do not have an equivalence from one country to another or whose attributes are likely to change during the study. In particular, I have a CSV file for storing the list of facilities + other attributes related to these facilities (e,g. the intervention status of a given facility will change during the study). This list of facilities is different in each country.
facilities.csv (192 Bytes)
I cascade the selection in 2 steps: first selection of the district, then selection of the facility within the selected district, using the search() function from an external CSV.
I was able to use the last-saved value as a dynamic default for the selection of the district without any problem (EDIT: I have actually tried to use it alone, and ODK Collect now keeps on crashing when I start a new form, so probably not working either), but I have not been able to use the dynamic default for the selection of the facility. I am wondering whether I should use last-saved in a different way, or whether this is something that is simply not possible in this context. Many thanks in advance for your insights!
I am aware of the fact that the ODK core team is generally not very much in favour of the use of the search() function and advising for limiting its use, but the proposed alternatives do not meet my requirements (although it is totally possible that I have missed something, in which case I will be happy to be proven wrong!).
2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Central v1.1.0
ODKCollect 1.29.3
3. What you have you tried to fix the problem?
Use ${last-saved#a1_2} as default, where a1_2 returns the name of the CSV choice (i.e. the key value in the CSV file)
02-TIMCI-SPA-CGEI-ref-form_demo.xlsx (18.6 KB)
Use ${last-saved#fname} as default, where fname returns the label of the CSV choice (i.e. the label value in the CSV file)
02-TIMCI-SPA-CGEI-ref-form_demo.xlsx (18.6 KB)
I have quickly double-checked that last-saved worked as intended with a "standard" select_one question, which was actually the case, so my current guess is that it is its use with the search() function that is indeed the issue.
4. What steps can we take to reproduce the problem?
See XLSForms and CSV attached above
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
See XLSForms and CSV attached above