I need to automatically calculate a field based on values from previous rows

5009
1
04-12-2016 04:35 PM
OLANIYANOLAKUNLE
Occasional Contributor II

I need to automatically calculate a field based on values from previous rows such that once the total of all the previous rows is greater than 450 and less than 500, the next row starts counting from 0 or the balance of what made the previous row greater than 500, i've been able to include my formula but it works within a single row i.e (${No of Persons in Sampled Building} + ${Estimated No of Persons in Residential Building}) the output would make the value for the field called Estimated Population 

Tags (1)
0 Kudos
1 Reply
EricRodenberg
Esri Contributor

Olaniyan,

I want to make sure I understand your question.  You have a survey question (field/column) and you want to automatically calculate the value of that column based on the answers of previously submitted surveys (rows)?  To my knowledge Survey 123 does not support reaching back into the feature service to pull out previous surveys and sum the values of a field.  This is due to the fact that Survey123 is working in an offline state storing the surveys until you upload the results. 

I can reach back into previous questions in the current survey.  So if your survey has three questions, Number of persons sampled building , and number of persons in residential building I can sum those values and pre-populate the third question called estimated population and hide it from  the survey. 

So my question to you are you trying to do this the first way or the second way.  To do this the second way,  refer to this link which explains how to create a calculation from previous questions using the XLSforms Calculation Column... Survey123 for ArcGIS support for XLSForm

Calculate.PNG

Eric J. Rodenberg | Solution Engineer Transportation Practice
Esri | 7775 Walton Pkwy, Suite 270 | New Albany, Ohio 43054-8202 | USA
T 614-933-8698, ext. 5503 | erodenberg@esri.com | esri.com
0 Kudos