I'm creating an inspection survey, that includes a feature class with the assets (it only has 4 points that correspond to the assets), and a related table for the inspections. I'm fairly sure the relationship is setup correctly because when I use the URL scheme, where Survey123 launches from Field Maps, I am able to collect data as I intend to.
My problem is that I would prefer my users to only have to access Survey123. I would like them to be able to choose an asset and then fill out the form. Currently when I do this, it adds a field to the relate, but it is not actually related to one of the assets.
I'm currently using the appearance field to search the feature class to populate the asset list, which seems to work fine, but doesn't relate the record. From reading various posts, seems like I'm missing the link to the parent global ID, but I'm unclear on how to do that correctly. I have a Parent GUID field in my inspection form, but no reference to the Parent Global ID. Do I need to do a pulldata() or search() on that?
Any guidance would be appreciated.
What were the fields used to make the relationship when the feature class was created? If it was created with Survey123 then the GlobalID to ParentGlobalID relationship would need to be maintained. If it was is the GUID field or something else then that would need to be maintained. You should be able to use pulldata() based on the return from your initial search() to populate that question.
So your search() question returns Asset1, then do a pulldata() on Asset1 to return your primary key from the parent table and use that to populate the foreign key in your related table i.e. pass that to the appropriate field through Survey123.
Hi @clill , i switched one of my inspection workflows from "Field Maps + Survey123" to "Survey123 only" as well in the last time. I did it like this:
I created one Survey with only the assets and the inbox activated ("asset-survey"). In this survey, the users see the assets as a list or map in the inbox (also to navigate to the asset) but cannot change any asset.
Additionaly, I created an "inspection-survey" to add inspections (repeat entries in the related table). Both Surveys are created from the same FeatureService in which the assets and inspections are written/edited. I only delete in Survey123 Connect the Fields I don't need.
The tricky thing I also experienced was to get globalids in the asset-survey, so I can pass that asset-globalid with an link as note to the inspection-survey with the Survey123-App-Linking-Scheme (comparable to the link from Field Maps).
The only way i got it running was to compare the featureservice with the asset-layer and have a look, how the GlobalID-Field is written there. Than I added an text-field-type in my asset-survey with the name and label of the GlobalID-Field from the featureservice (i.e. "GlobalID"). as bind::esri:fieldType I set it to "null". This way, I was able to reference the GlobalID with my link as a note in the survey to get the GlobalID from the asset, that gets inspected. The Link looks like this:
<a href="arcgis-survey123://?itemID= YOUR ITEM ID OF THE INSPECTION SURVEY &field:ParentGlobalID=${GlobalID}"> Add inspection</a>
How the app-linking works is explained here: https://doc.arcgis.com/en/survey123/get-started/integratewithotherapps.htm
How to build a Survey on top of an existing featureservice is explained here: Working with existing Feature Services in ArcGIS Survey123
you can also use one survey and look up the globalid using the search() option:
use in your Asset field as appearance this: autocomplete search("Field you want to search i.e. ASSETID?url=https://YOURPORTALORARCGISONLINE.com/SERVERNAME/rest/services/.../FeatureServer/LAYERID OF YOUR FEATURESERVICE", contains).
Although "autocomplete search()" does not appear in the options, you can use it, it is documented here:
Dynamic Choice Lists using Search Appearance
In your parentglobalid field you use the calculation
pulldata("@layer", "getValue", "attributes.GlobalID", "https://YOURPORTALORARCGISONLINE.com/SERVERNAME/rest/services/.../FeatureServer/LAYERID OF YOUR FEATURESERVICE", concat("Assetid='", ${ASSETID},"'"))
I hope that helps somehow.