How to count the number of 0's in a repeat?

155
2
03-14-2024 08:28 AM
PBGISIntern
New Contributor II

I'd like to count the number of 0 values produced in a repeat. I can't seem to do this with the count() function as it only counts total values, and can't be used to differentiate between values.

Tags (2)
0 Kudos
2 Replies
abureaux
MVP Regular Contributor

Depends what you mean by "0"...

But, something like this could work:

abureaux_0-1710441708514.png

 

if the number is a zero, the counter is "1". Otherwise, it's "0". Then, you just sum up the counter outside of the repeat and you will get the number of times the value was "0"

0 Kudos
DuncanC
New Contributor III

Unless one of the limitations on using javascript in Survey123 gets in your way like not being able to do it on public facing surveys I'd do it that way.  Passing repeats into a javascript function is well documented and really easy to work with, I find it way cleaner than trying to do it in the XLSform.

https://community.esri.com/t5/arcgis-survey123-blog/extending-survey123-smart-forms-with-custom-js/b...

0 Kudos