Pre-populate a select_multiple() type question using pull_data()

How can data from multiple columns in a CSV media file be used to pre-populate a select_multiple() type question? I know how to use pull_data() to pre-populate a select_one() type question.

Welcome @rajith_ids,
Could you provide more details what you exactly have and want to do, please.
E.g.

  • Do you want to “create” the choice_list or pre-set the answers in a select_multiple question?
  • Do you want to reference data from an external csv file or from a repeat group?

Hint: You probably know about select_multiple_from_file (see Help Center article).

1 Like

Dear @wroos,

Thank you for getting back to me. I am trying to populate the select_multiple() variable ‘w2_hh_work’ from data in ‘To_kobo.csv’.

I use a QR code to access ‘base_uuid’ which is the unique case id in the CSV file.

This works fine at times, but at other times gives the error in the attached screenshot.


To_Kobo.csv (600 Bytes)
Training.xlsx (16.7 KB)

Could you try to find out under which conditions you get the error, please: e.g. more than one work? work from different positions in the csv file?, a barcode not in csv file?

To better localise the problem, you might test first with changing the select to a simple text type and going stepwise with the position element, and also 1, 2, 3 or no work.

1 Like

Hi @wroos,

It turned out that this error happens only on KoboCollect on Android devices. However, there is no error when done on Kobo web.

Any ideas what might be going on?

Thank you

Rajith

Could you test this?
Does the problem always happen on all Collect Android device?

1 Like

No, only when the position is greater than 10 but only on the KoboCollect.

Rajith

Could you try to redeploy this form together with the csv file to an Android device and check the behaviour again, please?

You might even test this with a clone of the ptoject/form (and the same csv).

1 Like

While pull_data() can be used to pre-populate select_one() questions, pre-populating select_multiple() questions requires a slightly different approach.

To pre-populate a select_multiple() question with data from multiple columns in a CSV file, you’ll need to use the pulldata() function along with a calculation field