Select to view content in your preferred language

Feature Reports: Update Field From Previous Instance of Survey?

2317
21
Jump to solution
04-29-2025 09:34 AM
JW_TT
by
Occasional 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
21 Replies
Neal_t_k
Frequent 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
JW_TT
by
Occasional Contributor

So, you got it to work?? Ugh. I triple checked the url and it is set to allow querying. This is the ONLY time I've wanted one of those obscure ESRI error codes... at least I could google that. 

I'm baffled. It's gotta be something right in front of my face...

0 Kudos
JW_TT
by
Occasional Contributor

Sorry to bug you—but did you keep the spreadsheet that worked with your url? Would you mind posting it here (minus your url of course). I've gotten so far off track and have made so many changes, I want to see what worked. _sigh_

0 Kudos
Neal_t_k
Frequent Contributor

I changed everything back to your variables, but the attached does pull the most recent date when I hook it up to one of my feature layers???  If  not it may have something to do with your feature layer settings, have you checked the share setting in Survey123 site. 

NealKittelson_0-1746105325500.png

I am not sure if these setting would effect it but worth a shot

NealKittelson_1-1746105756517.png

 

 

JW_TT
by
Occasional Contributor

That helped... Thank you so much.

I can consistently pull in the date from the first tank... but not others. I'm going to try some of the suggestions above again, but if you have any other ideas, I'm all ears. 

 

Neal_t_k
Frequent Contributor

Ah yes, all dates are stored as UTC in that format, so if you pull it in a text field you do have to format it.

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

JW_TT
by
Occasional Contributor

I switched it back to a date field and it's formatting correctly. But I edited my post above. It's not working for anything other than the first tank. I need to delete all the records from AGOL and try again. 

0 Kudos
JW_TT
by
Occasional Contributor

Problem statement:
For any given feature, when it has been surveyed previously, and then is surveyed again, the pulldata syntax should pull in the last surveyed date into the "Prior Inspection" field.

0 Kudos
Neal_t_k
Frequent Contributor

I hooked it back up to my feature layer, the pulldata calculation is pulling the most recent date for multiple different entries???  Are you pulling from the correct feature layer?  If you have republished lately, you might check that the url is referencing the correct feature layer.   Seems there is either an issue/feature where upon republishing with an overwrite adds a new file with the same name but different service urls.

https://community.esri.com/t5/arcgis-survey123-questions/duplicate-feature-layer-after-re-publishing...

JW_TT
by
Occasional Contributor

I'm not sure what happened. At one point, no matter which feature I selected, the "Prior" field would populate with the date of the very first survey I had done. I don't know where that data is stored, but somewhere. And then I went into web Survey123 and deleted the remaining records. Reloaded. Verified that all surveys were deleted. Then checked in the feature layer only to discover remaining records. I know that there is a lot of caching going on, but I don't know if that explains it. I deleted all the surveys in the outbox on iOS. I then deleted the entire survey off the phone and tried again. Still was giving me the identical date for every feature. 

I nuked it. Deleted everything from AGOL. Verified the XLSForm and created a new survey. Updated the string with the new feature layer URL. 

It works. 

Green are new surveys that have no prior survey dates; blue are new surveys of those initial surveys showing the prior survey dates.

I'm going to do some more testing next week and see how it behaves.

I'm going to mark this solved. And if I have other issues, I'll create a new post. 

Thank you so much for your help!