Select to view content in your preferred language

How to display the last value from a repeat field in the parent record in Survey123?

87
1
a week ago
JuanTomásMartinez17
Esri Contributor

Hi everyone,

I'm building a Survey123 form in Connect, and I need help assigning the most recent value from a field inside a repeat in a field outside the repeat (i.e., in the parent layer).

Here's my structure:

  • A repeat called reporte_evento, which includes a field named heridos (injured).

  • Outside the repeat, I have a field called ult_envio_heridos where I want to automatically show the most recent value entered for heridos within the repeat.

What is the recommended way to achieve this?

I've seen references to pulldata("@last"), indexed-repeat(), and even pulldata("@layer"), but i couldn't get neither of them to work ,the ult_envio_heridos in the parent layer appears empty every time

Is there an official approach for this pattern?

Thanks in advance for your help!

0 Kudos
1 Reply
Neal_t_k
Frequent Contributor

I would try this with indexed-repeat first, that way you are not relying on online content to populate the answer.

to get that to work you will need to know how many repeats you have so you can have a dynamic indexed repeat calculation.

create a helper field outside the repeat and use the count function to get a count of your repeats.

name: heridos_count        count(${heridos})

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

then use that field in your indexed-repeat calculation

indexed-repeat(${heridos}, ${reporte_evento}, ${heridos_count})

 

edit: add screenshot:

Neal_t_k_0-1753719299850.png