Select to view content in your preferred language

Using the "if(selected" function with "indexed-repeats" to pull data from any created repeat

639
2
06-17-2022 01:48 PM
GBerry
by
New Contributor

Hi I'm working in S123, and I am making a relatively simple repeating data sheet to collect wildlife cam data.

However, I was hoping to make a summary checklist based on the cameras that have data collected, which will allow the field techs an easy check to see which cameras are completed. Below is the desired effect (A1 was filled out).

GBerry_0-1655498815642.png

 

I was able to do this when the data collection was not in the repeat format by using:

Type                              name                                  label                                                                                calculation

notecamera_A1<body bgcolor=${camera_A1_color}><font color="black"><b>A1</b></font></body> 
calculatecamera_A1_color if(selected(${A1_camera_on}, 'yes'), "#5ac18e", "#E7E7E7")

 

I changed the form around a bit and the selection to  ${camera_ID}, 'A1' which worked fine.

But now that it's in repeats, only the currently visible form is highlighting.

I've tried using script with iterations of:

calculation

if(selected(indexed-repeat(${camera_ID}, 'A1',${camera_repeat}, n)),  "#5ac18e", "#E7E7E7")

But the indexed-repeat does not seem to like the fact there's the 'A1' there.

And I'm also not sure if n is a proper way to say 'all repeats' or if 'all repeats' is possible.

Any help or guidance would be much appreciated!

0 Kudos
2 Replies
GBerry
by
New Contributor

Or in other words how can I combine this line of code:

if(selected(${camera_ID}, 'A1'), "#5ac18e", "#E7E7E7")

With every repeat that's been taken.

0 Kudos
JenniferAcunto
Esri Regular Contributor

I would create a field that concatenates all of your camera ids into a single field outside of your repeat using join(',', ${camera_ID}). Then change your if statements to if(contains(${cameras_joined}, 'A1'), '#5ac18e', '#E7E7E7')

- Jen
0 Kudos