Select to view content in your preferred language

Prepopulate certain fields in a new survey if a specific field entry matches a previously created survey

940
6
Jump to solution
01-17-2024 07:43 AM
Bec
by
Regular Contributor

Is there a way to prepopulate certain fields in a new survey entry if there is a previously submitted survey entry that matches for example an email field in both surveys?  What I'm looking to do is take the fields, First Name, Last Name, Street Address, Zip Code, and Phone Number....prepopulate those fields with the previously submitted survey's entries if the email address given for the new survey entry matches the previously submitted survey. I am using Survey123 Connect.  Refuse Survey.PNGRefuse Survey Excel.PNG

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

What about using pulldata("@layer")?  This function allows you to query an existing feature layer using an attribute query. You could make pulldata query the survey layer to see if the email has been previously submitted. If so, you can then prepopulate other fields accordingly.

This animation shows an example where the customer number is used to feed the pulldata("@layer") query

Survey123_Lookup.gif

More on pulldata("@layer") https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye... 

I have attached a sample XLSForm so you can see how it can be done but essentially, it would look like this:

IsmaelChivite_0-1705519688536.png

Line 2 takes the entered user_email in Line 1 and queries the layer URL specified in Line 4. The output of the query is used to populate Line 2.

The URL specified in Line 4 is the URL of the survey layer itself. You can hide the text question type in Line 4 by adding the keyword hidden into the appearance column

View solution in original post

6 Replies
abureaux
MVP Frequent Contributor

Short answer is 'no'. You can't pre-populate a survey based on the previously submitted survey.

There are some convoluted ways of potentially achieving this, but they would require a lot of effort. May be easier to have respondents just fill that info in again.

0 Kudos
IsmaelChivite
Esri Notable Contributor

What about using pulldata("@layer")?  This function allows you to query an existing feature layer using an attribute query. You could make pulldata query the survey layer to see if the email has been previously submitted. If so, you can then prepopulate other fields accordingly.

This animation shows an example where the customer number is used to feed the pulldata("@layer") query

Survey123_Lookup.gif

More on pulldata("@layer") https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye... 

I have attached a sample XLSForm so you can see how it can be done but essentially, it would look like this:

IsmaelChivite_0-1705519688536.png

Line 2 takes the entered user_email in Line 1 and queries the layer URL specified in Line 4. The output of the query is used to populate Line 2.

The URL specified in Line 4 is the URL of the survey layer itself. You can hide the text question type in Line 4 by adding the keyword hidden into the appearance column

abureaux
MVP Frequent Contributor

Man, am I bad at leaving thoughts half-finished.

My concern would be around Personally Identifiable Information (PII). Assuming that isn't a concern in this case, then this would work. I would encourage Bec (or rather anyone) to evaluate the business case and ensure that they won't be exposing anything unintentionally.

0 Kudos
Bec
by
Regular Contributor

This survey is for internal use only so I don't think that will be an issue.  I do appreciate you bringing that up though as sometimes it can be easily forgotten when we focus on task at hand.

Bec
by
Regular Contributor

I was thinking about the pulldata function as an option as I just used it to pull zip code lat/long for another section I added to the survey.  I would have to publish the survey first I think to get the associated URL needed to use with that function, but I think you may be right and that should work.  Hopefully once I get to a point of publishing the survey in the next week or so I can test this out and let you know if it worked.  Thanks again for the help!

0 Kudos
Bec
by
Regular Contributor

Sorry for the long delay, but I didn't end up going this route as the department I was working with wasn't using unique ID's and thus this wasn't a very good option for my project.  A co-worker of mine however is going this route with his project since he does have unique ID's for each customer and the pulldata function works great for pulling the customer information from another previously published survey into his new survey.  Thanks for passing on the information on how to do this!

0 Kudos