Cascade/dynamic select using preloaded csv data


This is my first post on this forum - just want to say thank you for this resource (both ODK but also the forum) - so helpful!

I am trying to figure out how to use cascade select using pull data. I've searched online, through this forum, and tried to replicate whatever sample files I could find - but no luck.

Here is the context of why we need this (in case it is helpful):

We are doing an endline evaluation of a program in a few weeks, but some of the participants have lost their cards (and do not know their card numbers), which is especially problematic since the program did not collect any other unique identifier (no names).

For participants who do not have their cards (or know their card numbers), our plan is to use the dynamic search function to narrow down or filter participants based on their responses to a series of demographic questions we will ask at endline. We collected demographic data at baseline, which we will upload as a .csv file and pull data from to narrow down choices until we have one or two options for card number.

We will ask the participants for the district and ward in which they were enrolled, as well as the highest level of education attained. I've figured out how to filter for these. However, I'm having difficulty filtering for any other variables (marital status, age, etc.). The form seems to work and the data preloads correctly, but when I go to collect data on the tablet, all questions after 'education' (e.g., age or marital status) do not automatically populate with a list of answer choices pulled from the preloaded .csv file.

As I said earlier - the resources on this forum are incredible and so I've been able to figure out the separate components (how to use pull data and how to use choice filtering) - but I haven't figured out how to put these two components together. Any thoughts?

Thanks so much,

Hi @taniareza! I'm really glad that both ODK and the forum have been helpful!

Any chance you could publically share a small test XLSForm and CSV with a handful of rows that demonstrates the problem? Having an example makes it easier for the community to help.

Also, when you get a chance, please introduce yourself here. It helps build a friendlier community when we know a little bit about each other!

1 Like

Sure @yanokwa , sorry for not attaching the file sooner. Here it is:
Dynamic select using preloaded .csv data

The highlighted row is where I keep getting tripped up. If I remove the row and replace the cardnumber appearance column with what is currently in row 6, it works - but it only lets me filter down by ward and education level.

I did try choice_filter, but I couldn't figure out how to set it up using pre-loaded data.

Thanks in advance for anything you can do to help!

  • Tania

PS. Introducing myself on the forum now!

Could you please make the sheet public (assuming it doesn't have any information that can't be public!) and read-only? Right now it requires requesting access.

@yanokwa Sorry about that - the link is now public (read-only)!

A6, B6 refer to variables called marriage but your choices sheet refers to a variable called married. I think that's the problem.

Hi Yaw,

Thanks for pointing that out. I changed the choices sheet to 'marriage', but I'm getting this error message: "Syntax error in search() function: The function needs 1, 4 or 6 arguments." We're getting closer though - it lets me filter for district > ward > education level > marital status, but the issue is coming up with the list of card numbers.

I'll keep playing around with it this weekend and make sure it's not a silly mistake on my end.

Thanks so much for your help with this,

I think the search() function can't dive into that many levels. If you need to go that many levels, you might need to try choice_filter. The link has an example.