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).
I was able to do this when the data collection was not in the repeat format by using:
Type name label calculation
note | camera_A1 | <body bgcolor=${camera_A1_color}><font color="black"><b>A1</b></font></body> | |
calculate | camera_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!
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.
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')