Constraints and Calling Repeat Values?

02-13-2018 03:12 PM
New Contributor

Hi There,

I am working on a groundwater sampling form. In this form we have a set of parameters that will over time become stabilized. We haven’t really figured out if we will use repeats or if we will create just multiple sections in the form in order to watch the data stabilize over time. The idea is to have the field value show red until it is stabilized which then it will show a green value in order to act as an alert. This alert notify's the samplers that sampling is complete. 


Stabilization means that our data falls within a percentage of the previous values or between specific values. Do you have any recommendations for:

               1. Watching the data stabilize over a time period (ie, go from red to green) using repeats vs multiple sections?                  Or a different alert method?         ***I am not sure if you can call previous value from a repeat section?

               2. Setting the constraints that show whether the values are within the specific ranges?

Ideally we’d like to see for example, if a temperature reading is within 3% of the previous 2 inputs, because then it is stabilized.  Is this possible in repeats and if not, how would I set this up in the calculation field if we used multiple sections?


We also want to calculate elapsed time during the sampling event, but again, I am not sure how to call on a previous value from a repeat or if its possible?

Let me know if it would help to see the excel file. I appreciate any advice.


2 Replies
Esri Esteemed Contributor

Hi Staci,

Currently, I would initially suggest multiple sections for the process you describe, so long as you have a maximum number of sample in your procedure.  

You cannot refer to previous repeats within Survey123; however, you can use aggregation functions (like sum() and count() ) to create variables in the parent form that can be referred to in the repeat.  There are issues if the calculations involve formulas that calculate distance from mean - those are not automatically updated when values in additional repeats end up modifying the mean.

New Contributor II


I was in the same boat as you looking for a solution for groundwater sampling. I've developed something using javascript to do the stability calculations on the repeat values. I only have calculations for pH, conductivity, and dissolved O2 but more could be added. I've attached the xls form and the javascript file to add to your 'scripts' folder in your survey. 


Tags (1)
0 Kudos