one to many relationships in Survey123 form

5904
13
06-22-2017 01:36 PM
DavidHume
Emerging Contributor

Hi,

I'm trying to work out how to create a Survey123 form which enables the user to capture overarching information about a 'site', surveyor name, weather, etc. and then has numerous 'observations' within the site with each observation inheriting the overarching information. This would be a one (site) to many (observations) relationship.

Does anyone know if this can be done in Survey123 and what needs to be done to allow this functionality? If anyone has any examples or can point me in the right direction that would be appreciated.

I'm new to Survey123, having been a long time ArcPad user, so if I've not been clear or this is already covered in other posts then I'd welcome your thoughts.

Thanks in advance,

David.

0 Kudos
13 Replies
JamesTedrick
Esri Esteemed Contributor

Hi David,

You probably want to create a form with a repeat section - that can create the site>observation survey design.  In the background, it uses related tables to store the information.  Repeats—Survey123 for ArcGIS | ArcGIS 

DavidHume
Emerging Contributor

Thanks James that is really helpful and solved my issue!

I have another which you may know the answer to as well. I have a select list (drop down) which, based on which answer the user chooses, it then automatically populates the next field. I looked at cascading selects and I can make this do what I need but I'd rather remove the user having to click and choose the answer to the 2nd question. To be specific the first question asks what the Latin name is of the bat species spotted and the 2nd field will be it's common name. There are only about a dozen or so possible responses to question 1 so I thought that a kind of 'if' statement might do the trick but then decided that there has got to be a better and automated way to do this. Any help would be very welcome!

0 Kudos
JamesTedrick
Esri Esteemed Contributor

This might be a good use case for the pulldata() function- you can attach the table of Latin & common name as a CSV file with the survey and look up the common name based on the Latin name.  See Formulas—Survey123 for ArcGIS | ArcGIS  and https://community.esri.com/groups/survey123/blog/2016/10/27/the-pulldata-function-access-external-da... 

DavidHume
Emerging Contributor

Hi James.

Thanks again, that did the trick!

I was a sceptic when ArcPad was being replaced by numerous alternatives including Survey123 but I'm being won over!

David. 

DavidHume
Emerging Contributor

Last question (for today at least!).

I've got an If statement in my original excel spreadsheet 'form' which I'd like to use in Survey123. Is there any easy way to convert this to Survey123 compliant syntax? I've given it a go from what I've seen online but it's not working as I'm sure I've not interpreted the rules correctly!

if(selected(${HSIScore}<=0.5),'Poor',if(selected(${HSIScore}<=0.59),'Below Average',if(selected(${HSIScore}<=0.69),'Average','Excellent')))

so in effect the field would be updated with the word Poor if the preceding text question (HSIScore had an answer of less than or equal to 0.5, Below Average for >0.5 but <=0.59 and so on, with Excellent being the value where HSIScore doesn't meet any of those defined criteria.

Any advice as to how to do these nested if statements in Survey123?

Thanks in advance.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

The issue looks to be with the selected() functions - the syntax for selected is selected(${Question},<value>) and is designed to work with multiple choice (and secondarily, single choice) questions.  If you have a question HSIScore and it's of decimal type (which is implied by the rest of the statement, you should be fine simply by removing the selected() functions:

if(${HSIScore}<=0.5,'Poor',if(${HSIScore}<=0.59,'Below Average',if(${HSIScore}<=0.69,'Average','Excellent')))

DougHaller1
Occasional Contributor

James,

I am using the online survey 123 design tool. Is there a way to do the above without having to start from a xlsForm?

0 Kudos
DougHaller1
Occasional Contributor

Dave:

I have the same question only I am working with the Esri online survey123 product. I am using their tools, not an xlsform.  It would appear that in the online survey 123 rules only allow one to skip to a future question and not return to a previous series of questions.  For my example, I want wildlife volunteers to be able to enter multiple bird observations for a single location before entering data for a new location.  

Have you found a way to create this one to many or "loop" in Survey123 online?

Thanks

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Doug,

Currently, forms authored in the Survey123 website do not support repeats (loops).  We do have in available a web form that can support surveys created by Survey123 Connect, including repeats, in beta (to be released with 2.3).