How to pre-fill a repeating group question?


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 link.

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[websites/link]

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:[websites/link][websites/link]

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="" xmlns:ev="" xmlns:h="" xmlns:jr="" xmlns:odk="" xmlns:orx="" xmlns:xsd="">
    <model odk:xforms-version="1.0.0">
        <data id="snapshot_xml">
          <websites jr:template="">
      <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"/>
    <input ref="/data/What_is_your_name">
      <label>What is your name?</label>
    <input ref="/data/Where_do_you_live">
      <label>Where do you live?</label>
    <group ref="/data/websites">
      <repeat nodeset="/data/websites">
        <input ref="/data/websites/link">
          <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.


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?