Follow Up survey: Pre-Load data

285 views
Skip to first unread message

Neil Hendrick

unread,
May 25, 2018, 5:16:44 PM5/25/18
to enketo-users
Does enketo support pre-loading data? 

Open Data Kit supports this as described here: https://opendatakit.org/help/form-design/data-preloading/

To provide some details, I am designing a survey using ODK Collect. The survey will be conducted with a random selection of people, and the respondents will be asked for a contact email address so that we can send them a link to a follow up Enketo survey (through Aggregate). It would be useful to be able to pull some data from the original survey for the follow up survey on Enketo.

Thanks in advance, 
Neil Hendrick

Martijn van de Rijdt

unread,
May 25, 2018, 5:40:33 PM5/25/18
to enketo...@googlegroups.com
Hi Neil!

Yes, it does, with some options:

External XML data (this is the method I recommend for more complex data)
- like this: https://opendatakit.github.io/xforms-spec/#secondary-instances---external (and in XLSForm: `select from external YOURFILE.xml`).

External CSV data 
We have some unfortunate incompatibilities with external CSV data that we're still trying to rectify.
- in both Enketo and ODK Collect you can use the pulldata() function
- in Enketo you can also do `select from external YOURFILE.csv`. After that the data is available as XML. See https://enketo.org/xforms/#csv-support.
Just to be clear: no search() support and no "select external" support in Enketo.

Using defaults[] in Enketo's API (recommended for simple stuff)
- Dynamically create an online-only Enketo webform URL that passes data values to be populated in the form. See https://apidocs.enketo.org/v2#/post-survey

A fourth option would be hack around Enketo's API that is meant for editing already submitted data, but I think that's probably not appropriate here.

Good luck!

Martijn

P.S. This may be of interest as well, if you're only expecting a single response per person: https://apidocs.enketo.org/v2#/post-survey-single




--
You received this message because you are subscribed to the Google Groups "enketo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enketo-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Pushing data since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog

-- 
Revolutionizing data collection since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog

Motari Ongeta

unread,
Sep 20, 2018, 4:41:06 AM9/20/18
to enketo-users
Hi Martijn,
I have uploaded a sample of my form that users search(). Please help me develop an external XML data file that I can use in place of search(). I actually have 2 csv files that accompany the survey in the sample please advise on how I can call the 2 csv's.
Your help on this would be much appreciated.


On Saturday, 26 May 2018 00:40:33 UTC+3, Martijn van de Rijdt wrote:
Hi Neil!

Yes, it does, with some options:

External XML data (this is the method I recommend for more complex data)
- like this: https://opendatakit.github.io/xforms-spec/#secondary-instances---external (and in XLSForm: `select from external YOURFILE.xml`).

External CSV data 
We have some unfortunate incompatibilities with external CSV data that we're still trying to rectify.
- in both Enketo and ODK Collect you can use the pulldata() function
- in Enketo you can also do `select from external YOURFILE.csv`. After that the data is available as XML. See https://enketo.org/xforms/#csv-support.
Just to be clear: no search() support and no "select external" support in Enketo.

Using defaults[] in Enketo's API (recommended for simple stuff)
- Dynamically create an online-only Enketo webform URL that passes data values to be populated in the form. See https://apidocs.enketo.org/v2#/post-survey

A fourth option would be hack around Enketo's API that is meant for editing already submitted data, but I think that's probably not appropriate here.

Good luck!

Martijn

P.S. This may be of interest as well, if you're only expecting a single response per person: https://apidocs.enketo.org/v2#/post-survey-single



On Fri, May 25, 2018 at 3:16 PM, Neil Hendrick <mojo...@gmail.com> wrote:
Does enketo support pre-loading data? 

Open Data Kit supports this as described here: https://opendatakit.org/help/form-design/data-preloading/

To provide some details, I am designing a survey using ODK Collect. The survey will be conducted with a random selection of people, and the respondents will be asked for a contact email address so that we can send them a link to a follow up Enketo survey (through Aggregate). It would be useful to be able to pull some data from the original survey for the follow up survey on Enketo.

Thanks in advance, 
Neil Hendrick

--
You received this message because you are subscribed to the Google Groups "enketo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enketo-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Pushing data since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog
Placing_Combinations (1).csv
CPS_TEST.xlsx

Martijn van de Rijdt

unread,
Sep 20, 2018, 12:32:24 PM9/20/18
to enketo-users
Hi Motari,

Let me help you on your way with the conversion of CSV to XML (for the ideal external data that can be used in both ODK Collect and Enketo).


1. I cut-and-paste the csv content in the top field but left out the first line of headings
2. I created a template that would work with select_one_from_file:

<item>
   <key>##1##</key>
   <name>##2##</name>
   <label>##3##</label>
</item>

The ##1##, ##2##, ##3## refer to the column on each row.

3. Click convert CSV to XML to get your XML result and save it to a file in a text editor, e,g. as countries.xml

You can now save that to a file and use "select_multiple_from_file countries.xml"

4. I didn't look at your form in great detail, but the choice_filter for cps_select_all could be something like "key=${calc_combi}" 

I think the "all" choice list is not correct. The name should probably be a two-letter string. Not sure what the choices column is for.

Good luck, and just share again if get stuck!

Cheers,
countries.xml

Motari Ongeta

unread,
Sep 21, 2018, 4:30:43 AM9/21/18
to enketo...@googlegroups.com
Hi Martijn,
I Have tried using the file countries xml shared and the the csv version I cant seem to be getting any lists. 
I have revised the questionnaire to make and made it short and clear.

I need to use this on enketo webforms.
Kind Regards,
Motari



CPS_TEST.xlsx
countries1.csv
countries.xml

Martijn van de Rijdt

unread,
Sep 21, 2018, 11:36:22 AM9/21/18
to enketo-users
Hi Motari,

Thanks for posting this. I didn't realize a small but important issue in the converted XML I sent you yesterday. Sorry about that. The root node is called "document". To make it compatible with XLSForm, this should be changed to "root" (occurs twice). (Alternatively, you could also do this in the XForm (search for "itemset") and leave countries.xml unchanged).

Then it will work fine: https://enke.to/::bqULCbbX

For the CSV attempt, you'll need to change the headings of the "code" and "country_names" column to "name" and "label" respectively to be compatible with XLSForm.

Both these changes (for XML and CSV) are not an Enketo restriction but are the result of some hardcoded XForm output in XLSForm (so the external data structure has to comply with that output). It's the compromise we made to keep XLSForm somewhat clean and easy to use. However, we'll definitely have to figure out how make it easier to use external data. A lot of untapped potential there!

Cheers,
Martijn

To unsubscribe from this group and stop receiving emails from it, send an email to enketo-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
countries.xml

Motari Ongeta

unread,
Sep 22, 2018, 3:30:09 AM9/22/18
to enketo...@googlegroups.com
Thank you so much. Its finally working now.
I finally can use both the xml and csv.

Kind Regards,
Motari




-- 
Revolutionizing data collection since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog

--
You received this message because you are subscribed to the Google Groups "enketo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enketo-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Kind Regards,
Motari



Message has been deleted

Matti Tiira

unread,
Dec 17, 2018, 6:14:12 AM12/17/18
to enketo-users
Hi! 
I'm having some difficulties pulling data from csv file with Enketo webforms. 
Here are my form and the csv file that I would want to pull the data from. For some reason they're not working.
Is there something wrong with the form or the csv file?

-Matti
DiipaDaapa.xlsx
siirto.csv

Martijn van de Rijdt

unread,
Dec 19, 2018, 4:42:44 PM12/19/18
to enketo-users
Reply all
Reply to author
Forward
0 new messages