# Populating first loop item with earlier field data

**URL:** <https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803>\
**Category:** Support\
**Created:** [September 25, 2015, 1:22pm UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803 "2015-09-25T13:22:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tumaini\_Kilimba1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/tumaini_kilimba1/32/5911_2.png) [@Tumaini\_Kilimba1](https://forum.getodk.org/u/Tumaini_Kilimba1)\
**Post date:** [September 25, 2015, 1:22pm UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803/1 "2015-09-25T13:22:47Z")

</div>

Dear all,  
I have a household survey where early on I ask for the Head of House ID,  
firstName,middleName and Surname. Later on within the same survey I start a  
loop where I want to register all household member IDs, firstNames,  
middleNames and Surnames. Considering I have already done this for the head  
of house earlier, I am wondering how I can pre-populate the firstName,  
middleName and Surname fields \*only on the first loop. \*Subsequent loops  
should not pre-populate. Is this possible, selectively pre-populating a  
loop based on jr:count maybe?

Thanks in advance,  
Tumaini

---

<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:** [September 25, 2015, 4:48pm UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803/2 "2015-09-25T16:48:08Z")

</div>

This is not possible.

Each copy of the loop is expected to behave identically.

> **···**
>
> On Fri, Sep 25, 2015 at 6:22 AM, Tumaini Kilimba wrote:
> 
> > Dear all,  
> > I have a household survey where early on I ask for the Head of House ID,  
> > firstName,middleName and Surname. Later on within the same survey I start a  
> > loop where I want to register all household member IDs, firstNames,  
> > middleNames and Surnames. Considering I have already done this for the head  
> > of house earlier, I am wondering how I can pre-populate the firstName,  
> > middleName and Surname fields \*only on the first loop. \*Subsequent loops  
> > should not pre-populate. Is this possible, selectively pre-populating a  
> > loop based on jr:count maybe?
> > 
> > Thanks in advance,  
> > Tumaini
> > 
> > ## --
> > 
> > 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:** ![Tumaini\_Kilimba1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/tumaini_kilimba1/32/5911_2.png) [@Tumaini\_Kilimba1](https://forum.getodk.org/u/Tumaini_Kilimba1)\
**Post date:** [September 25, 2015, 5:42pm UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803/3 "2015-09-25T17:42:05Z")

</div>

Thanks

> **···**
>
> On Sep 25, 2015 7:48 PM, "Mitch Sundt" wrote:
> 
> > This is not possible.
> > 
> > Each copy of the loop is expected to behave identically.
> > 
> > On Fri, Sep 25, 2015 at 6:22 AM, Tumaini Kilimba [tkilimba@ihi.or.tz](mailto:tkilimba@ihi.or.tz) wrote:
> > 
> > > Dear all,  
> > > I have a household survey where early on I ask for the Head of House ID,  
> > > firstName,middleName and Surname. Later on within the same survey I start a  
> > > loop where I want to register all household member IDs, firstNames,  
> > > middleNames and Surnames. Considering I have already done this for the head  
> > > of house earlier, I am wondering how I can pre-populate the firstName,  
> > > middleName and Surname fields \*only on the first loop. \*Subsequent loops  
> > > should not pre-populate. Is this possible, selectively pre-populating a  
> > > loop based on jr:count maybe?
> > > 
> > > Thanks in advance,  
> > > Tumaini
> > > 
> > > ## --
> > > 
> > > 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:** ![Lloyd\_Banwart](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/lloyd_banwart/32/1773_2.png) [@Lloyd\_Banwart](https://forum.getodk.org/u/Lloyd_Banwart)\
**Post date:** [September 28, 2015, 1:39am UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803/4 "2015-09-28T01:39:49Z")

</div>

Tumaini,

As Mitch said, each loop behaves identically. I use the attached example as  
an effective work around for these situations. It can require a little more  
work on the data cleaning end, but I've found that utilizing this can  
reduce HH roster errors.

In short you have two questions within the HH roster repeat group for each  
question you want pre-populated based on previously collected data. The  
first Q is only relevant on the first loop (and pre-populated) and the  
second Q is relevant for all other loops.

~Lloyd

[HH\_roster\_example.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/9/9625b3c5b1b221aa66edeef44d5253fbad71de07.xlsx) (10.5 KB)

> **···**
>
> On Friday, September 25, 2015 at 1:42:10 PM UTC-4, Tumaini Kilimba wrote: \> \> Thanks \> On Sep 25, 2015 7:48 PM, "Mitch Sundt" \<mitche...@gmail.com \> wrote: \> \>\> This is not possible. \>\> \>\> Each copy of the loop is expected to behave identically. \>\> \>\> \>\> On Fri, Sep 25, 2015 at 6:22 AM, Tumaini Kilimba \<tkil...@ihi.or.tz \> wrote: \>\> \>\>\> Dear all, \>\>\> I have a household survey where early on I ask for the Head of House ID, \>\>\> firstName,middleName and Surname. Later on within the same survey I start a \>\>\> loop where I want to register all household member IDs, firstNames, \>\>\> middleNames and Surnames. Considering I have already done this for the head \>\>\> of house earlier, I am wondering how I can pre-populate the firstName, \>\>\> middleName and Surname fields \*only on the first loop. \*Subsequent \>\>\> loops should not pre-populate. Is this possible, selectively pre-populating \>\>\> a loop based on jr:count maybe? \>\>\> \>\>\> Thanks in advance, \>\>\> Tumaini \>\>\> \>\>\> -- \>\>\> -- \>\>\> Post: opend...@googlegroups.com \>\>\> Unsubscribe: opendatakit...@googlegroups.com \>\>\> Options: 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...@googlegroups.com . \>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\> \>\> \>\> \>\> \>\> -- \>\> Mitch Sundt \>\> Software Engineer \>\> University of Washington \>\> mitche...@gmail.com \>\> \>\> -- \>\> -- \>\> Post: opend...@googlegroups.com \>\> Unsubscribe: opendatakit...@googlegroups.com \>\> Options: 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...@googlegroups.com . \>\> For more options, visit https://groups.google.com/d/optout. \>\> \>

---

<div class="post-metadata">

**Author:** ![Tumaini\_Kilimba1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/tumaini_kilimba1/32/5911_2.png) [@Tumaini\_Kilimba1](https://forum.getodk.org/u/Tumaini_Kilimba1)\
**Post date:** [September 28, 2015, 9:59am UTC](https://forum.getodk.org/t/populating-first-loop-item-with-earlier-field-data/4803/5 "2015-09-28T09:59:28Z")

</div>

Thanks Lloyd I will try this solution

regards  
Tumaini

> **···**
>
> On Mon, Sep 28, 2015 at 3:39 AM, Lloyd Owen Banwart \<lloyd.banwart@gmail.com wrote:
> 
> > Tumaini,
> > 
> > As Mitch said, each loop behaves identically. I use the attached example  
> > as an effective work around for these situations. It can require a little  
> > more work on the data cleaning end, but I've found that utilizing this can  
> > reduce HH roster errors.
> > 
> > In short you have two questions within the HH roster repeat group for each  
> > question you want pre-populated based on previously collected data. The  
> > first Q is only relevant on the first loop (and pre-populated) and the  
> > second Q is relevant for all other loops.
> > 
> > ~Lloyd
> > 
> > On Friday, September 25, 2015 at 1:42:10 PM UTC-4, Tumaini Kilimba wrote:
> > 
> > > Thanks  
> > > On Sep 25, 2015 7:48 PM, "Mitch Sundt" [mitche...@gmail.com](mailto:mitche...@gmail.com) wrote:
> > > 
> > > > This is not possible.
> > > > 
> > > > Each copy of the loop is expected to behave identically.
> > > > 
> > > > On Fri, Sep 25, 2015 at 6:22 AM, Tumaini Kilimba [tkil...@ihi.or.tz](mailto:tkil...@ihi.or.tz) wrote:
> > > > 
> > > > > Dear all,  
> > > > > I have a household survey where early on I ask for the Head of House  
> > > > > ID, firstName,middleName and Surname. Later on within the same survey I  
> > > > > start a loop where I want to register all household member IDs, firstNames,  
> > > > > middleNames and Surnames. Considering I have already done this for the head  
> > > > > of house earlier, I am wondering how I can pre-populate the firstName,  
> > > > > middleName and Surname fields \*only on the first loop. \*Subsequent  
> > > > > loops should not pre-populate. Is this possible, selectively pre-populating  
> > > > > a loop based on jr:count maybe?
> > > > > 
> > > > > Thanks in advance,  
> > > > > Tumaini
> > > > > 
> > > > > ## --
> > > > > 
> > > > > Post: [opend...@googlegroups.com](mailto:opend...@googlegroups.com)  
> > > > > Unsubscribe: [opendatakit...@googlegroups.com](mailto:opendatakit...@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...@googlegroups.com](mailto:opendatakit...@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  
> > > > [mitche...@gmail.com](mailto:mitche...@gmail.com)
> > > > 
> > > > ## --
> > > > 
> > > > Post: [opend...@googlegroups.com](mailto:opend...@googlegroups.com)  
> > > > Unsubscribe: [opendatakit...@googlegroups.com](mailto:opendatakit...@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...@googlegroups.com](mailto:opendatakit...@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).
