# Indexed-repeat() error

**URL:** <https://forum.getodk.org/t/indexed-repeat-error/4356>\
**Category:** Support\
**Created:** [May 20, 2015, 5:36pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356 "2015-05-20T17:36:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![martijnr](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/martijnr/32/1614_2.png) [@martijnr](https://forum.getodk.org/u/martijnr)\
**Post date:** [May 20, 2015, 5:36pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/1 "2015-05-20T17:36:24Z")

</div>

I'm trying to get a simple test form with the indexed-repeat() function to  
work in the latest version of ODK Collect. This form throws an error when  
creating the second  
repeat: [https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0](https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0)

It passes ODK Validate. Does my form contain a mistake?

> **···**
>
> -- -- \*Revolutionizing data collection since 2012.\*
> 
> Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> | Blog [http://blog.enketo.org/](http://blog.enketo.org/)

---

<div class="post-metadata">

**Author:** ![crobert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/crobert/32/1613_2.png) [@crobert](https://forum.getodk.org/u/crobert)\
**Post date:** [May 20, 2015, 5:44pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/2 "2015-05-20T17:44:07Z")

</div>

Works okay with the latest SurveyCTO tools. You might open an issue with  
the details of the error.

Best,

Chris

> **···**
>
> --- Christopher Robert Dobility, Inc. (SurveyCTO) http://www.surveycto.com/ http://blog.surveycto.com/
> 
> On Wed, May 20, 2015 at 1:36 PM Martijn van de Rijdt [martijn@enketo.org](mailto:martijn@enketo.org) wrote:
> 
> > I'm trying to get a simple test form with the indexed-repeat() function to  
> > work in the latest version of ODK Collect. This form throws an error when  
> > creating the second repeat:  
> > [https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0](https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0)
> > 
> > It passes ODK Validate. Does my form contain a mistake?
> > 
> > --  
> > _Revolutionizing data collection since 2012._
> > 
> > Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> > [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> > [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> > | Blog [http://blog.enketo.org/](http://blog.enketo.org/)
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [May 20, 2015, 6:07pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/3 "2015-05-20T18:07:48Z")

</div>

Attached is a working form.

Not sure why this is different between SurveyCTO and base ODK Collect.

The problem seems to be that indexed-repeat, when given a position value of  
0, returned a set of nodes, rather than picking a specific one. The  
position is 1-based.

I fixed the form by adding a guard condition in front of the indexed-repeat

[indexed\_repeat.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/6/6ec910e86986c964af8134b1ee3d57b603d69937.xlsx) (10.5 KB)

> **···**
>
> On Wed, May 20, 2015 at 10:44 AM, Christopher Robert wrote:
> 
> > Works okay with the latest SurveyCTO tools. You might open an issue with  
> > the details of the error.
> > 
> > Best,
> > 
> > Chris
> > 
> > * * *
> > 
> > Christopher Robert  
> > Dobility, Inc. (SurveyCTO)  
> > [http://www.surveycto.com/](http://www.surveycto.com/)  
> > [http://blog.surveycto.com/](http://blog.surveycto.com/)
> > 
> > On Wed, May 20, 2015 at 1:36 PM Martijn van de Rijdt [martijn@enketo.org](mailto:martijn@enketo.org) wrote:
> > 
> > > I'm trying to get a simple test form with the indexed-repeat() function  
> > > to work in the latest version of ODK Collect. This form throws an error  
> > > when creating the second repeat:  
> > > [https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0](https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0)
> > > 
> > > It passes ODK Validate. Does my form contain a mistake?
> > > 
> > > --  
> > > _Revolutionizing data collection since 2012._
> > > 
> > > Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> > > [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> > > [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> > > | Blog [http://blog.enketo.org/](http://blog.enketo.org/)
> > > 
> > > ## --
> > > 
> > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > 
> > > * * *
> > > 
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Community" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![martijnr](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/martijnr/32/1614_2.png) [@martijnr](https://forum.getodk.org/u/martijnr)\
**Post date:** [May 20, 2015, 6:52pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/4 "2015-05-20T18:52:45Z")

</div>

Thanks!

> **···**
>
> On Wed, May 20, 2015 at 12:07 PM, Mitch Sundt wrote:
> 
> > Attached is a working form.
> > 
> > Not sure why this is different between SurveyCTO and base ODK Collect.
> > 
> > The problem seems to be that indexed-repeat, when given a position value  
> > of 0, returned a set of nodes, rather than picking a specific one. The  
> > position is 1-based.
> > 
> > I fixed the form by adding a guard condition in front of the indexed-repeat
> > 
> > On Wed, May 20, 2015 at 10:44 AM, Christopher Robert \< [crobert@surveycto.com](mailto:crobert@surveycto.com)\> wrote:
> > 
> > > Works okay with the latest SurveyCTO tools. You might open an issue with  
> > > the details of the error.
> > > 
> > > Best,
> > > 
> > > Chris
> > > 
> > > * * *
> > > 
> > > Christopher Robert  
> > > Dobility, Inc. (SurveyCTO)  
> > > [http://www.surveycto.com/](http://www.surveycto.com/)  
> > > [http://blog.surveycto.com/](http://blog.surveycto.com/)
> > > 
> > > On Wed, May 20, 2015 at 1:36 PM Martijn van de Rijdt [martijn@enketo.org](mailto:martijn@enketo.org) wrote:
> > > 
> > > > I'm trying to get a simple test form with the indexed-repeat() function  
> > > > to work in the latest version of ODK Collect. This form throws an error  
> > > > when creating the second repeat:  
> > > > [https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0](https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0)
> > > > 
> > > > It passes ODK Validate. Does my form contain a mistake?
> > > > 
> > > > --  
> > > > _Revolutionizing data collection since 2012._
> > > > 
> > > > Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> > > > [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> > > > [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> > > > | Blog [http://blog.enketo.org/](http://blog.enketo.org/)
> > > > 
> > > > ## --
> > > > 
> > > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > > 
> > > > * * *
> > > > 
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "ODK Community" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > ## --
> > > 
> > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > 
> > > * * *
> > > 
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Community" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Mitch Sundt  
> > Software Engineer  
> > University of Washington  
> > [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "ODK Community" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/opendatakit/3YPaBX1pBRE/unsubscribe](https://groups.google.com/d/topic/opendatakit/3YPaBX1pBRE/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> ## --
> 
> _Revolutionizing data collection since 2012._
> 
> Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> | Blog [http://blog.enketo.org/](http://blog.enketo.org/)

---

<div class="post-metadata">

**Author:** ![crobert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/crobert/32/1613_2.png) [@crobert](https://forum.getodk.org/u/crobert)\
**Post date:** [May 20, 2015, 7:19pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/5 "2015-05-20T19:19:00Z")

</div>

Oh -- sorry! I'd assumed that he was getting errors with valid index  
values. But, curiously, 0 is also treated as 1 in SurveyCTO -- probably a  
change we made at some point to help with validation and other cases where  
not-yet-initialized values were being passed as the index parameter.

Best,

Chris

> **···**
>
> On Wed, May 20, 2015 at 2:07 PM Mitch Sundt wrote:
> 
> > Attached is a working form.
> > 
> > Not sure why this is different between SurveyCTO and base ODK Collect.
> > 
> > The problem seems to be that indexed-repeat, when given a position value  
> > of 0, returned a set of nodes, rather than picking a specific one. The  
> > position is 1-based.
> > 
> > I fixed the form by adding a guard condition in front of the indexed-repeat
> > 
> > On Wed, May 20, 2015 at 10:44 AM, Christopher Robert \< [crobert@surveycto.com](mailto:crobert@surveycto.com)\> wrote:
> > 
> > > Works okay with the latest SurveyCTO tools. You might open an issue with  
> > > the details of the error.
> > > 
> > > Best,
> > > 
> > > Chris
> > > 
> > > * * *
> > > 
> > > Christopher Robert  
> > > Dobility, Inc. (SurveyCTO)  
> > > [http://www.surveycto.com/](http://www.surveycto.com/)  
> > > [http://blog.surveycto.com/](http://blog.surveycto.com/)
> > > 
> > > On Wed, May 20, 2015 at 1:36 PM Martijn van de Rijdt [martijn@enketo.org](mailto:martijn@enketo.org) wrote:
> > > 
> > > > I'm trying to get a simple test form with the indexed-repeat() function  
> > > > to work in the latest version of ODK Collect. This form throws an error  
> > > > when creating the second repeat:  
> > > > [https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0](https://docs.google.com/spreadsheets/d/1VSv7Ck3JiPBd6LQRntOMfDHyoiUzSf2w7bKO19JW0QU/edit#gid=0)
> > > > 
> > > > It passes ODK Validate. Does my form contain a mistake?
> > > > 
> > > > --  
> > > > _Revolutionizing data collection since 2012._
> > > > 
> > > > Enketo [https://enketo.org/](https://enketo.org/) | LinkedIn  
> > > > [http://www.linkedin.com/company/enketo-llc](http://www.linkedin.com/company/enketo-llc) | GitHub  
> > > > [https://github.com/enketo](https://github.com/enketo) | Twitter [https://twitter.com/enketo](https://twitter.com/enketo)  
> > > > | Blog [http://blog.enketo.org/](http://blog.enketo.org/)
> > > > 
> > > > ## --
> > > > 
> > > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > > 
> > > > * * *
> > > > 
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "ODK Community" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > ## --
> > > 
> > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > 
> > > * * *
> > > 
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Community" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Mitch Sundt  
> > Software Engineer  
> > University of Washington  
> > [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [June 22, 2026, 7:02pm UTC](https://forum.getodk.org/t/indexed-repeat-error/4356/6 "2026-06-22T19:02:44Z")

</div>

2 posts were split to a new topic: [Error about repeated field maybe needing indexed-repeat()](https://forum.getodk.org/t/error-about-repeated-field-maybe-needing-indexed-repeat/58290)
