Indexed-Repeat to pull previous pin spacing and resistence measurement

570
6
03-04-2022 02:30 PM
PrabhaVenu
New Contributor

I am using Survey123 desktop app version 3.13.251. For the attached survey form (excel sheet), I am unable to get indexed-repeat to work with this error: 

PrabhaVenu_0-1646432791858.png

I am using type "note" as mentioned in a previous solution for another similar question and i am following this exact code recommended but I still get this error and would like some help from this well-versed community. I am attaching my code as the excel sheet. 

PrabhaVenu_1-1646432928569.png

 

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

You may need to bind the position field to int or just use position inside the indexed repeat and it way work.

PrabhaVenu
New Contributor

Hello Doug,

Thank you for your recommendations. I tried both the bind and directly using position inside the indexed-repeat, both didn't work. Not sure what i am missing..I am including both the survey form with the bind defined and the error message when I execute it.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Are you outside the repeat?

The indexed-repeat() function cannot be used inside the repeat that it references, as this will cause a circular reference. For example, the following expression cannot be used for a calculation inside the repeat named defects:

indexed-repeat(${defect_type}, ${defects}, 3)

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformrepeats.htm 

0 Kudos
PrabhaVenu
New Contributor

Yes, I understand that constraint. Is there a way to get the previous value within this repeat loop? I really need to get this previous value inside this loop, since i am trying to calculate the resistivity for each sample point for a total of > 1 sample points. Basically resistivity at samples points 1, 5, 50 feet, etc respectively. And the formula references the previous sample point (feet and resistivity measured). I would like to do this without asking the person filling the form in the field to have to input the previous values.

0 Kudos
DougBrowning
MVP Esteemed Contributor

You may be able to out indexed outside then reference the field inside.

You can also maybe have the calc just outside the repeat so the user can still see it.

But if you just need the values at the 5s I would just have an if that does if mod 5 = 0 then store the number.  Then add all of those up using sum.  This may not be what you need but its an idea.

0 Kudos
PrabhaVenu
New Contributor

Thanks for these suggestions, I will give them a try.

0 Kudos