Select to view content in your preferred language

Survey123 Report: use a field from a repeat as where clause in different repeat

259
2
Jump to solution
05-06-2025 01:10 PM
jmaxwell_braun
Regular Contributor

In a feature report, is it possible to use the value of a field from one repeat in the where clause of a second repeat? The two repeats are direct children of the parent record but are not nested with each other.

That is what I'm trying to do:

${#repeat1}
${#repeat2 | where:"field1inrepeat2=field1inrepeat1"}${field2inrepeat2}${/}
{$/}

 I've tried a bunch of different variations for the where clause, such as where:"field1inrepeat2='"+repeat1.field1inrepeat1+"'" or where:"field1inrepeat2="repeat1.field1inrepeat1"

The goal is to pull a value from a different repeat if the date in the current repeat record matches it.

Any help would be appreciated! I've read through all of the documentation, videos, and a bunch of posts but I can't determine if this is possible or not.

0 Kudos
1 Solution

Accepted Solutions
TylerGraham2
Frequent Contributor

The ${#repeat1} ${#repeat2}...${/}${/} only works if they are nested. You need to use $layers to independently call layers in your feature service.  

Documentation for $layers is excellent, consisting of 1 entire sentence.  

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-expressions.htm#:~:text=%2...

You might try combing the repeat and $layers into something like:

${#repeat2 | where:"fieldrepeat2= '" + ${$layers["repeat1name"] | where:"1=1" | outFields:"repeat1date"} + "'"} 

and see what happens.

I'd test the $layers independently to get it working before you try passing it into something. I have found it to be very finicky to get anything working with it.  

View solution in original post

0 Kudos
2 Replies
TylerGraham2
Frequent Contributor

The ${#repeat1} ${#repeat2}...${/}${/} only works if they are nested. You need to use $layers to independently call layers in your feature service.  

Documentation for $layers is excellent, consisting of 1 entire sentence.  

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-expressions.htm#:~:text=%2...

You might try combing the repeat and $layers into something like:

${#repeat2 | where:"fieldrepeat2= '" + ${$layers["repeat1name"] | where:"1=1" | outFields:"repeat1date"} + "'"} 

and see what happens.

I'd test the $layers independently to get it working before you try passing it into something. I have found it to be very finicky to get anything working with it.  

0 Kudos
jmaxwell_braun
Regular Contributor

Thanks @TylerGraham2! I briefly tried the method you outlined without success but I will look into it further. For now, I was able to use an if statement instead.

0 Kudos