Single column CSV media does not work

Hi there,

Description

When dealing with a CSV having a single column (with or without a final comma on each row), pulldata() does not work.

Example of use case: I want to check an entered value against a huge list but I don’t want the user to be able to see all the list (so no big.select_one, whether with search appearance or not. It will even be safer with hashes the day Enketo implements the function digest().

If I change the file to contain:
item_key,dummy_header
item_1,dummy
item_2,dummy

then the exact same pulldata(‘items’, ‘item_key’, ‘item_key’, ‘item_1’) will return ‘item_1’, as expected.

Steps to Reproduce

  1. Upload as “media” the file ‘items.csv’, containing only:
    item_key
    item_1
    item_2

  2. Make a form with

  • a calculate field named ‘calc’ containing:
    pulldata(‘items’, ‘item_key’, ‘item_key’, ‘item_1’)
  • a note field containing
    Pulled: ${calc}
  1. Launch the date collection (Enketo, online): the note field will show no pulled data.

  2. update the file ‘item.csv’ to:
    item_key,dummy_header
    item_1,dummy
    item_2,dummy

  3. Redeploy and relaunch Enketo, the note field will display:
    Pulled: item_1

Expected behavior

Enketo able to pull data from a single-column CSV file

Actual behavior

Enketo not able to pull data from a single-column CSV file

Cheers!

Hi @freedim,

Have you tried using the csv as shared and discussed earlier. It should work:

Have a great day!

Hi @Kal_Lam,

Thanks for responding, but perhaps you should read my post, which is not about how to use a CSV or the function pulldata.

Cheers.

1 Like

Hi @freedim,

Would you mind having a look at the sample csv that i shared in post that i shared earlier:

Codes.csv (285 Bytes)

Try using the csv in this format and you should be able to overcome the issue you are currently having.

Have a great day!

Sorry @Kal_Lam but I keep thinking you have not actually read my post

1 Like

Hi @freedim,

Have you prepared an xlsform and a csv for this. It would be easy for us to test the same at our end.

Have a great day!

I don’t have this but you can generate one by copy/pasting what I provide in the OP. As a reminder:

  • a calculate field named “calc” containing:
    pulldata(‘items’, ‘item_key’, ‘item_key’, ‘item_1’)

  • a note field containing:
    Pulled: ${calc}

  • a media file named “items.csv” containing:
    item_key
    item_1
    item_2

Cheers