AnsweredAssumed Answered

Calculation Doesn't Fire Inside Repeat

Question asked by dbecker88 on Mar 29, 2019
Latest reply on Apr 1, 2019 by JTedrick-esristaff
integertotal_repeatsNumber Repeatscount(${dummy_counter})
decimalmean_vegAverageround(sum(${num_veg}) div ${total_repeats},2)
begin repeatquadsQuad Data Entry
hiddendummy_counterincraments repeat count1
integernum_veg# Vegetative0
decimalnum_veg_sqdifSq Difference Vegpow((${num_veg} - ${mean_veg}),2)0
end repeat



A portion of the XLS form is above, the problem is that the num_veg_sqdif doesn't automatically re-calculate after new repeat records are added. Notice how the calculation uses the mean of all values inside the repeat. This mean value changes when a new repeat is added, thus all previously calculated num_veg_sqdif values need to be re-calculated.


The only way to do that is to manually page back through the repeat records and hit the arrow button (looks like the recycle symbol) on the num_veg_sqdif field.


The survey123 docs say this: "Unlike the default column, which is evaluated only when the survey is opened or the question becomes relevant, calculations are evaluated every time answers in your survey that are inputs to the calculation change or become relevant."


Why isn't the re-calculation happening inside the repeat, is this expected behavior?


BTW: this entire post would be a moot point if there were  a few more aggregation functions that work with repeats, submitted idea here: Survey123 - Standard Deviation and Mean Across Repeat