Preload ODK Tables with image prompts

1. What is the problem? Be very detailed.

I’m looking to preload some tables with data via CSV. This seems pretty straightforward working from the examples and the short notes in the docs, but what I haven’t found yet is whether it’s possible to preload image prompts.

I have all the images I’d like to use and a CSV file with all the rest of the fields in it, but I can’t tell if there’s a way to populate the image prompt columns.

The tables in question are for product types and staff, both of which prompt for an image.

2. What app or server are you using and on what device and operating system? Include version numbers.

ODK 2.1.1 on Windows 10, with ODK Services/Survey/Tables 2.1.1 on an Android device (LG V30 during development). Forms designed via App Designer.

3. What you have you tried to fix the problem?

Guessing various values for the image prompt column.

4. What steps can we take to reproduce the problem?

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

For anyone who searches for this, I eventually solved my own problem.

The easiest route is probably to fill out a form with an image prompt on your device, then export the CSV from ODK Tables, and download it all to see the folder structure. You can then recreate it in your CSV import folder.

In the example below I’ll use a table called “my_form_name”, which has 2 rows in it’s CSV with UUIDs in the _id column.

  - my_form_name.csv
  - my_form_name/
    - instances/
      - uuid_2eb6e55e_2f2a_4d39_b579_c741a810361b/
        - filename.jpg
      - uuid_5a51cf0d_48b8_4cdc_bc63_348b635ef693/
        - another_filename.jpg

In the my_form_name.csv file then, you have the _id column matching the UUIDs of the folders above of course, plus two columns for the image prompt field, named mypromptname_contentType and mypromptname_uriFragment.

mypromptname_contentType in this example would always be image/jpg (it’s a mime type), and mypromptname_uriFragment is the filename, so filename.jpg and another_filename.jpg.

I hope this helps somebody else with the same problem in future!