June 10, 2021, 8:56am
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.
June 10, 2021, 9:26am
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>
June 10, 2021, 9:31am
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
to learn more on pull data. Pull Data Functionality in KoBoToolbox
June 10, 2021, 9:41am
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?
June 10, 2021, 10:07am
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?
June 10, 2021, 10:29am
Checking my dataset, the case with the most values is 147!
Oh! That’s a huge number.
June 10, 2021, 11:07am
However, even knowing how to deal with 2 cases would be useful
@Josh and @martijnr to see if this is possible.
June 10, 2021, 5:30pm
@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.
Im trying to do something a bit different but kind of similar. I’m trying to pull data from a data set that has a “/”. I.e.: Group/fruit_key
This slash happens because im linking this data set to an other dataset produced by an other form and the question is inside a group. The pull function works fine with no /.
Any idea on. how to solve this?