I have a survey I’d like to pre-fill, which has repeat-groups. How do I pre-fill the questions in the repeat groups?
A specific example: I want to ask for (say) a list of website links. The questionnaire contains a repeating group with ID
websites containing a single question with ID
I already discovered how to pre-fill this once, as it works the same as for normal questions. I can create a link like this, which prefills it with
But I need to pre-fill many of these links. This list of links can be long, of the order of tens of values, and I want to avoid the user having to type them all in if I can, and instead just amend the list I already have in a pre-filled form.
Repeat URL parameters with the same key is valid in a URL, so I though maybe just repeating it would work, but this guess seems not to work - only the last parameter is seen:
Can anyone help?
Thanks in advance.
Welcome to the community, @wu-lee! I don’t know if this is possible, but would you mind sharing with the community your sample xlsform that has the question and the working link that can prefill the response as required.
Attached is a test case… or there would be I if had the permission to upload. So here it is inline:
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<bind jr:preload="timestamp" jr:preloadParams="start" nodeset="/data/start" type="dateTime"/>
<bind jr:preload="timestamp" jr:preloadParams="end" nodeset="/data/end" type="dateTime"/>
<bind nodeset="/data/What_is_your_name" required="false()" type="string"/>
<bind nodeset="/data/Where_do_you_live" required="false()" type="geopoint"/>
<bind nodeset="/data/websites/link" required="false()" type="string"/>
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/>
<label>What is your name?</label>
<label>Where do you live?</label>
<label>What are your favourite websites?</label>
An aside - possibly an alternative might be to preload using the
pulldata function in an XLS
calculate column However, although I found an example of this, I wasn’t able to get this to work. It did not seem to be able to find the csv file I uploaded, and the error message wasn’t very helpful.
I don’t have the exact details to hand, I wanted to check this seems feasible at all first?
@wu-lee, you should now be able to upload your xlsform. If you still have any issues please refresh your page.
Maybe you could have a look at our support article Pull Data Functionality in KoBoToolbox to learn more on pull data.
Thanks. XLS export atttached.aZCj7rjdhGu2qvLzo4k3Tz.xlsx (6.0 KB)
@wu-lee, are the total number of websites fixed where the enumerator is able to select all those that he/she likes?
The number of websites isn’t fixed, and no, it’s not a case of multiple select. Typically each response will have a unique list of one or more responses.
So what could be the maximum number of websites for each respondents? Any rough clue?
Checking my dataset, the case with the most values is 147!
Oh! That’s a huge number.
However, even knowing how to deal with 2 cases would be useful
Pinging in @Josh and @martijnr to see if this is possible.
Hi @wu-lee, I’m not sure if it’s possible to achieve what you’re wanting, but I’ll leave it to the community to suggest a possible solution.