Select to view content in your preferred language

Feature Reports: Update Field From Previous Instance of Survey?

235
14
Tuesday
JW_TT
by
Emerging Contributor

I've created a feature report for surveying the status of items in a factory. The items are surveyed once a month. The Survey123 survey looks great. The feature report template puts out a pdf that looks great. One of the fields on the survey is "Inspection Date" for the date of the survey. There is also a field "Previous Inspection Date." When the survey is first carried out, "Previous Inspection Date" will be blank. After a month, on the date of the second survey, I'd like the "Previous Inspection Date" field to be populated with the date of the first survey. Every month when the surveyor surveys a particular item, the date of the previous survey of that item is automatically populated.

I've tried "pullData" syntax in a variety of forms, but none seem to work. Am I just missing something? This must be a common process. I'm in a fairly strict corporate environment. Any suggestions, links, etc., would be great.

Thanks!

Tags (1)
0 Kudos
14 Replies
Neal-Kittelson
Regular Contributor

How is the survey form setup? Are surveyors collecting a new record each time they perform an inspection or are you using a repeat function and they are opening an existing form and adding the new information in a repeat?

If it is a new survey form each visit, you will probably need to using the pulldata function to pull the previous date from your data into your form first before you try putting in the report.

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

https://community.esri.com/t5/arcgis-survey123-questions/survey-connect-123-to-pull-data-function-an...

If you are collecting dates within a repeat, there is specific format for calling data from within a repeat.

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-repeats.htm

Some more information would be helpful on how your form is setup.

JW_TT
by
Emerging Contributor

Hi,

Thank you very much for the response. 

The surveyors are collecting a new record each time. I've attached my XLS Form. I thought that my syntax is correct. I've collected a couple of surveys of the same container (NB-1) and am under the impression that when I select container "NB-1" that the "Prior Monthly Inspection Date" text field on a new survey on my phone, that data should be pulled into that field. But that's not happening. 

I know just enough to be dangerous, so thank you again for the help!

0 Kudos
Neal-Kittelson
Regular Contributor

Try something like this:

NealKittelson_0-1746021967932.png

You may need to adjust the where clause to ensure you are get the most recent date.

https://community.esri.com/t5/arcgis-survey123-questions/is-it-possible-within-a-survey123-smart-for...

0 Kudos
JW_TT
by
Emerging Contributor

Thank you for that. I've deleted all previous records in the feature class. I've republished the survey. I've created one new inspection of NB-1 so "most recent date" should make no difference. 

And... nada. I start a new survey of NB-1 and the "Prior Inspection Date" field remains blank. 

Any thoughts? I'm stuck. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

pulldata tends to fire first before co_fa has a value.  Try adding a relevant so it does not fire until co_fa is filled out.  You can also try calculationmode=always

0 Kudos
JW_TT
by
Emerging Contributor

Can I talk you into putting that into the XLS so I can see it that way? I'm a visual learner and need to actually see it in place to make it connect. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Just add this to the relevant for pulldata line  string-length(${co_fa}) > 0

0 Kudos
JW_TT
by
Emerging Contributor

Hmm. That just made the entire prior inspection field disappear from the survey. That's one way of dealing with it, but unlikely to make my boss happy. 😑

I'm not sure what to try next, everything seems in order. 

0 Kudos
Neal-Kittelson
Regular Contributor

I am not sure, I couldn't test with your feature. I did try replacing the url with one of my features and I was able to pull a date.  You may check your feature and ensure it is able to be queried.

Open the details page for that feature in AGOL.  Scroll down to the URL, and click view, scroll to the bottom and you should see something like this:

NealKittelson_0-1746045455790.png

If that "Query" is there, I would follow Doug's suggestion above.

 

Also to get the most recent date, you can add this to the end of your url:  "?orderByFields=in_da_da DESC&resultRecordCount=1"  (order by your date field in descending order, and return one result).

look at request parameters here: https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm#ESRI_SECTION1_BB97985...

0 Kudos