Survey123 running total - what's the best way to get this as a deliverable?

310
1
11-27-2023 08:23 PM
MichelleWilliamsERM
Occasional Contributor III

I have employee hours inside a repeat and a sum outside the repeat. That part is working.

I want a running total calculated for the total employee hours for the project in Survey123 or via a feature report.

I'm noticing that Survey123 can keep a sum running as long as the survey is open, but once the survey is closed and reopened, the sum starts over. I also read a post that says something similar.

I've looked into aggregate functions in the summary feature report, but it's not working for me yet.

I've attached my survey and a photo of how I'd like it to work. I would love a fresh set of eyes.

 @JamesTedrick @IsmaelChivite 

1 Reply
ChristopherCounsell
MVP Regular Contributor

You can save a lot of headaches by moving your post-processing outside of the survey form. All the most difficult surveys I've come across have been when the entire solution logic has been inserted into the survey form. The others are when one survey submission is used for an entire project when it was better served as several instances of 'collect > submit'. 

Were you planning on using the inbox? Download and add new records? Issue with the Sum calculating previous repeat values that aren't getting downloaded?

Or is the survey saved as a draft and you're finding that it's not calculating the sum when Survey123 is closed/opened?  Again, preference would be that data is collected when relevant - not having days or weeks of data stored on a single offline device.

Without fully comprehending your survey or workflow, an alternative approach could be:

  • Survey form to collect new daily reports (project code from drop-down or custom URL link to tie form to existing project)
  • ArcGIS Notebook to use python to update the project sum with the new information. You can run these for a very low number of credits up to every 15minutes. Or manually as required.

If you're using inbox and want a running total, you may be able to use the pulldata(@layer) expression to get output statistics Sum for the layer fields. However you'd need to be online and add the current value in the survey. Take a look at the sample survey in Connect

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

You could also achieve similar with JavaScript. Both seem technical and have limitations. 

If you're using drafts to store all that data and the sums aren't working on reopening, it sounds like a known defect? And I'd reconsider your approach altogether per the earlier comment of all data on one device.

Also, you can use yes_no for several questions. Don't need to create a second list for the same values.