Select to view content in your preferred language

Editing both Parent and Child with both FieldMaps and Survey123

825
4
01-19-2024 11:15 AM
Caitlin_Todd_LCOR
Regular Contributor

Hi all, 

I have a rather complex issue I'm struggling with. I have a request to build an offline FieldMaps solution to collect culvert line features. These culverts will also have a related table for condition assessments. Due to how the requestor wants their assessment form to look like (one 'select all that apply' type question and several numbers stored as text in likert style) I need to use Survey123 as well. I've attached these apps together via a URL before with success for other projects, but this time it's not working. Ideally, FieldMaps would have support for multiple choice fields and more customization for the look of form itself, but we're not there yet.

I have three requirements for this request that limit my options for the solution overall.

  1. The requirement to be able to work completely offline. This removes the option for utilizing Pulldata functions.
  2. The requirement to have some of the culvert field values within the survey123 form for relevant calculations. For example, if the culvert material is concrete (a parent layer attribute), the assessment questions for plastic culverts need to be hidden. So, I'd need to reference both the culverts and their related assessment table within the same Survey123 form.
  3. The requirement to be using a sub-meter GPS device paired to FieldMaps for greater accuracy with digitizing line features, as well as using Arcade to perform spatial calculations in the FieldMaps smart form to pull in attributes from nearby road and stream features.

I’ve attached the XLS form I’ve been trying to use and the URL parameters I’m using to pull values from FieldMaps to Survey123 is below.

arcgis-survey123://?itemID=<itemID>&field:GlobalID={GlobalID}&field:Culvert_GUID={GlobalID}&field:ConduitID={Conduit_ID}&field:Material_={Material}&field:Material_Other_={Material_Other}&field:Culvert_Shape_={Culvert_Shape}&field:Culvert_Function_={Culvert_Function}&field:Culvert_Shape_Other_={Culvert_Shape_Other}&callback=https%3A%2F%2Ffieldmaps.arcgis.app%2F%3FitemID%3D4b175a38b5344dd2bf8fa36bef5022bb%26referenceContext%3Dopen

So far I’ve tried:

  • Recreating the survey, pointing it to my existing feature service, and publishing the survey directly. No modifications to the form at all. This works, I can create a simple line feature in Survey123 and fill out the assessment form and it creates everything perfectly. Just doesn’t have the spatial accuracy, digitizing tools, or Arcade spatial calculations that I need.
  • Next, I tried taking out all the culvert fields from the Survey123 form. This also works as expected but due to the requirement #2 that says culvert fields are needed for relevant calculations, I need the culvert field values to be in the form.

When I try to use this form as it is now, the culvert GlobalID isn’t being passed through to the assessment repeat neither are ‘some’ of the other culvert field values. Some of them do get passed through. But they’re all configured the same way in the form.

I’m using Survey123 Connect v. 3.19.114, FieldMaps v.24.0.1, and publishing from Pro v. 3.2.0

I guess at the heart of the matter is: Is it possible to reference an entire feature service, both the parent and child layers, within one Survey123 form? How to preserve both the Culvert GlobalID and pass it to the assessment within one form?

Many thanks to any and all advice, 

Caitlin

Lane County GIS

0 Kudos
4 Replies
DougBrowning
MVP Esteemed Contributor

I think you may need to remove the {}.  Seen it posted a few times and I do not think it is fixed yet.

See https://community.esri.com/t5/arcgis-survey123-questions/pass-attribute-field-as-url-parameter/td-p/... 

Me personally i don't use globalids for the key in the relate and it is all so much easier.  Plus if you ever move records to SDE later evey thing breaks.  I got a some more into here https://community.esri.com/t5/arcgis-survey123-questions/integrating-field-maps-with-survey123-using... 

Also I cant tell but maybe you want to grab info from the parent to send to the child from the child record?  If so you can use FeatureSetByRelationship in Arcade to query the parent and then pass that in the URL. This does work offline and I use it a lot.

Hope that does it

0 Kudos
ChristopherCounsell
MVP Regular Contributor

Why are you passing globalid=Globalid? Not a question in the survey and as far as I'm aware not something we'd want to do.

Are you encoding your URL? The link will have a hard time passing values with spaces or special characters if the URL isn't encoded. You can use Arcade to do this.

https://doc.arcgis.com/en/survey123/get-started/integratewithotherapps.htm#ESRI_SECTION1_7E0A66ACA85...

https://community.esri.com/t5/arcgis-survey123-blog/understanding-survey123-s-custom-url-scheme/ba-p...

https://developers.arcgis.com/arcade/function-reference/text_functions/#urlencode

 

0 Kudos
Caitlin_Todd_LCOR
Regular Contributor

Thank you both very much Doug and Christopher, I tried using your advice but still not having any luck. 

@ChristopherCounsell  I was seeing odd behavior of the survey creating new, null geometries in my culvert line layer and attaching the related assessment record to that instead of the correct feature. So to troubleshoot, I tried passing feature's GlobalID through the URL to see if that would work. It did not.

@DougBrowning  I also tried following the links you sent and set up an Arcade expression to build and encode the URL that way and have it scrape away the {} from the GlobalID, and after splitting the Concatenate in two I was able to test it. Unfortunately it still isn't pulling over any information from the parent culvert layer including the GlobalID.

My Arcade expression to build the URL is below. I needed to perform some IF statement checks to ensure null values weren't trying to be sent through in the URL and then adding a couple more Concatenates to ensure everything was pieced together correctly. As an aside, I noticed that Concatenate only works for three inputs at a time. After some testing I found that the GlobalID was being sent from FieldMaps to Survey123 correctly without needing to scrape out the {}, so maybe ESRI started making improvements on it?

var S123urlsource = 'arcgis-survey123://?itemID=ITEMID&field:Culvert_GUID='+$feature.globalid+'&field:Culvert_Function='+$feature.Culvert_Function+'&field:Material='+$feature.Material+'&field:Culvert_Shape='+$feature.Culvert_Shape+'';

var materialcheck = IIF($feature.Material_Other!=null,Concatenate(S123urlsource,'`&field:Material_Other='+$feature.Material_Other+``),'')
var shapecheck = IIF($feature.Culvert_Shape_Other!=null,Concatenate(S123urlsource,'`&field:Culvert_Shape_Other='+$feature.Culvert_Shape_Other+``),'')

var callback = '&callback:submit='
var FMurlsource='https://fieldmaps.arcgis.app?';
var FMparams='itemID%3DITEMID%26referenceContext%3Dopen%26featureSourceURL%3Dhttps://services1.arcgis.com/FNSBkbt9MsC1V9Cx/arcgis/rest/services/Culvert_Inventory_and_Assessments/FeatureServer%26';
var appendchecks = Concatenate(S123urlsource,materialcheck,shapecheck)
var firstpart= Concatenate(appendchecks,callback,UrlEncode(FMurlsource));
var final = Concatenate(firstpart,FMparams)
return final

 

But unfortunately I've run out of time to dedicate towards figuring out how to have both the parent and child fields in the Survey form, so I had to re-create everything in order to have something working quickly. I now have it working by having only the related Assessment fields were in the survey form then duplicating some of the culvert fields into the related Assessment table and converting my "select all that apply" requirement into several Yes/No fields.

It's not my ideal solution, but it gets staff out into the field to begin data collection.

Again thank you both for your insights and advice, I really appreciate it!

I hope to one day be able to revisit this and really dive into how to get it to work.

Caitlin

0 Kudos
ChristopherCounsell
MVP Regular Contributor

Caitlin it sounds like you are trying to edit the existing feature.

Survey123 was originally designed to collect new data. Only later was the ability to edit existing records added, using the Survey123 inbox.

You have two options.

Have the survey target the related table only. Use the form_id in settings. Launch the survey off the parent feature, passing the globalid into the parentglobaldid question. This will store records in the related table of the parent feature. It won't update the parent. You could use ArcGIS Notebook scripts or another process to push the info back to the parent.

The second option is to use the Survey123 Inbox. You'll need to set this up on your survey, enable sync on your later. Then launch the survey with url parameters to open the existing record directly in the inbox. This method updates both directly but does not support field value parameters from the popup. Images also won't go offline in survey123. Here's a link to another post with the arcade expression:

https://community.esri.com/t5/arcgis-survey123-questions/open-existing-record-in-survey123-phone-app...

0 Kudos