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
Upload as “media” the file ‘items.csv’, containing only:
item_key
item_1
item_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}
Launch the date collection (Enketo, online): the note field will show no pulled data.
update the file ‘item.csv’ to:
item_key,dummy_header
item_1,dummy
item_2,dummy
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