Hi,
I know that it is possible to have a final total at the bottom of a survey based on a group of questions. I have a repeat group and I'd like to have a total to calculate all the entries from the repeats. What is the proper syntax for this?
Thank you!
Hi! Thanks for your feedback. This is in our back-log at the moment. Please if not already vote for and comment on this idea: https://community.esri.com/ideas/12210
Hey Ismael,
I went and voted for it as a future built-in feature. In the meantime, are you aware of any workaround syntax?
Best,
Sunny
Hi Sunny. No workarounds that I am aware of. Sorry.
Hi Sunny,
I have a bit of a clunky workaround. Instead of having your questions in a repeat, you have to duplicate them as many times in the main survey as you think there could be possible responses. So rather than having species name and count in a repeat I have Species1Name, Species1Count then Species2Name, Species2Count and so on up to a couple of dozen species. I then put relevant restrictions on each one so that the species 2 fields only appear if there are values for species 1. It then means you can use the count field in calculations, though it means you end up with a very long calculation that capture the values from all the fields. It also adds lots of fields to your main form and I find if any of the repeat fields have long choice lists (as my species field does) then the more iterations you add of a field looking up the long list, the slower the form is to run to the point where my form refuses to run after about 4 iterations of the species field which is looking up an external choice list of a couple of thousand choices. As I said, a bit clunky but it works if you don't need to have too many repeated records, too many fields in your repeats or too many choices for one of your fields in the repeat.
Hope this helps,
James.
I'd definitely use the feature of getting a sum from within a repeated group. Thanks!
Hi Rosemary,
This was actually added over the summer to Survey123 - see the "Repeat Aggregated Functions" topic in https://community.esri.com/groups/survey123/blog/2017/06/02/world-milk-day-release-21 as well as Repeats—Survey123 for ArcGIS | ArcGIS
Thanks so much! I had seen SUM in the list and gave it a try but it didn't work. User error! I used regular parentheses instead of curly brackets. Thanks again -- it works like a charm!
Hi James Tedrick
Is there a limitation to perform the sum ($ {question}) function with hidden (relevant) questions?
I have a question outside the repeat (question_3), with a function to add the values of a question into the repeat (sum ($ {question_2}).
Additionally question_2 is hidden based on another question ($ {question_1} = 'AAA').
If question_1 is different 'AAA', question_2 will have no value, therefore question_3 will not return any value.
This behavior generates that if in question_5 we want to add question_3 with question_4, question_5 does not return any value.
Whereas all questions are 'interger'
Best regards!!
Hi Fernando,
As described in the Empty Values section of Formulas—Survey123 for ArcGIS | Documentation , if a question with no value is involved in a calculation, the result is no value. If you have a question with a possibly null value in a formula, I would recommend using the coalesce() function to test for null and provide a default value if it is null. For addition, that default value normally is 0 (as any value +0 is the original value).