Auto-populate repeating form fields using a query string

How to Auto populate repeating form fields/grids using query string in Enketo form.

We are using below versions
ODK Version : 2.0.5
Enketo Version : 2.1.1

Tried building query string , but able to populate only first row of repeating table/grid
How can i populate multiple rows using query string

Query String :
https://{domain-name}/x/ir5M7ZUS/?&d[/data/group1/cancer_repeat/others]=1&d[/data/group1/cancer_repeat/report]=1&d[/data/group1/cancer_repeat/refer]=1&d[/data/group1/cancer_repeat/mgmt]=1

PFA excel form which is used to generate repeat grid type form

repeat_block.xlsx (11.2 KB)

PFB form screenshot, we were able to populate 1 row , but how could we populate multiple rows using query string.

@martijnr can you please help us out on this

Hi @Anant,

The questions are referred to using XPath. In XPath 'positions' are 1-based so the first repeat is /data/group1/cancer_repeat[1] (or as you used, since it will get the first automatically) and the second is /data/group1/cancer_repeat[2]. Please make sure to use Enketo's API as it will take care of encoding the query parameters.

I hope this helps. This is not a heavily-used feature, so you may very well find bugs. If you do, please report them here: https://github.com/enketo/enketo-express. I'm not actually sure if the non-first repeat instances are created automatically. I don't think we've tested this...

Hi @martijnr,

Thanks for quick reply.

As per your suggestion above , I tried.

https://{domain-name}/x/ir5M7ZUS/?&d[/data/group1/cancer_repeat[1]/others]=1&d[/data/group1/cancer_repeat[1]/report]=1&d[/data/group1/cancer_repeat[1]/refer]=1&d[/data/group1/cancer_repeat[1]/mgmt]=1&d[/data/group1/cancer_repeat[2]/others]=1&d[/data/group1/cancer_repeat[2]/report]=1&d[/data/group1/cancer_repeat[2]/refer]=1&d[/data/group1/cancer_repeat[2]/mgmt]=1

But its populating 1 row only.
PFB screenshot.

Kindly let me know if am doing anything wrong with the query.

Thanks and Regards,
Anant

Hi @Anant,

If you are using the API instead of the handcrafted unencoded URL you posted, you seem to be doing this right. So there is likely a bug in this feature wrt non-first repeat instances. If you have time to create a nice reproducible issue on GitHub, that would be much appreciated.

Cheers,