Create summary of each answer to repeat question

183
4
03-01-2024 12:39 PM
SarahKendell
New Contributor III

Hello - what I want may not be achievable using a repeated question but I'm trying to make a very dynamic survey with minimal question clutter. This survey will be used to monitor seedling regeneration following timber harvests. Page 1 of the survey covers plot information and then I currently have a repeated question on Page 2 (pictured below). The user then selects a species and tallies regen in the 6 size classes, adding a new entry for every species. 

SarahKendell_0-1709325262459.png

 

What I would then like is to run a few different summaries based on those entries. Total by species/size class, calculated trees per acre using our plot factor, and comparing values against a set index to assess regen success.

The problem I'm facing is when I reference the fields in the repeat, it is only registering the active repeated question and not all entries within the repeat, so my calculated fields are reading out 0 when there is actual data there. 

Is there a way to achieve this within a repeated question or should I be considering a different survey design? There are ~30 species to choose from, so the repeated question would be a good way for me to only analyze present species without having to create a question for every species.

I achieved these results in the past by doing a lot of post processing in Excel and rejoining data after the fact. I am trying to streamline the process and have the survey do the bulk of the work as data is collected. 

I would appreciate some help on this as I am still familiarizing myself with how Survey 123 Connect works. Thanks!

0 Kudos
4 Replies
abureaux
MVP Regular Contributor

Summaries need to go outside of a repeat. Use sum() to add up items that exist in a repeat. (The calculate for sum() needs to exist outside the repeat).

0 Kudos
ChristopherCounsell
MVP Regular Contributor

Worth having a read of this post:

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-repeats/ba-p/89804...

Survey123 supports a handful of functions to work with repeats - max, min, count and sum. 

You can join strings together but it's more useful for a visual summary of data collected, harder to work with for calculations. So easy repeat calculations are largely limited to math. 

You could use string functions on summarized text e.g. Sum all species questions, then use contains(string, substring) as a relevant statement to hide/show questions specified to the species (substring).

More complicated analysis will likely require a JavaScript function. You can pass the repeat into JavaScript as an Array and then do a lot more than you can within the XLSForm. 

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

I generally advocate to keep complexity outside of the fieldwork. You set yourself up for difficulty and potential issues should the data requirements change. If you've got something working in Excel you definitely need to consider the effort involved now and in future.

0 Kudos
SarahKendell
New Contributor III

Hi Christopher - thanks for the information. Yeah, I'm coming to the conclusion that this might be more work than it's worth to execute in Survey 123, or at least calculation wise. Using what you mentioned above, I may opt for a text summary only to keep it simple and continue to handle the more complex processing after collection in Excel. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Data expressions in Dashboards may be a way.

0 Kudos