Week One: August 6 - August 9
Apis Arborea: Creating Relationship Class between Nests and Monitoring Reports
Key Insights:
Data and relationship classes must be created in a geodatabase
Relationships must be established prior to upload to AGOL
I did create a new geodatabase, which I uploaded to your AGOL portal
We will have to revisit how to link the Survey123 results to this data. I will also research other ways to create relationships for existing AGOL data.
Next Steps:
Researched ways to work with existing feature layers in Survey123
Followed directions from this Esri Community post to make sure the new feature layer supported edits with GlobalIDs
Created a new survey that was linked to our new feature layer from the start
Survey123 Connect automatically created an XLSForm schema and populated the survey
ERROR:
“Your layer must have an indexed GlobalID field and all relationships, including attachment tables, must leverage GlobalID fields.”
This is a problem for us because our key relationship leverages the “Nest ID” and “pick_nest_to_add_report” fields, which are just String fields, not GlobalID.
I’m also not sure we can edit the relationship (or add a new one) to leverage the GlobalID instead, because the GlobalID isn’t the information that joins the two datasets.
I found an Esri Community post where another user was experiencing effectively the same exact issue: their current data collected from Survey123 relied on a Site ID to relate reports back to the Site data.
They created a python script to populate a new GUID field in the related tables based on the original Site ID. The comments of the post detail exactly how to build out such a script.
Before jumping down the Python scripting rabbit hole, I just wanted to test if I could replicate the form template in FieldMaps and preserve the relationship.
I was able to pretty easily generate a FieldMaps form using the new relationship-enabled feature layer. Configuring the form itself may require a bit more time and effort, especially if some of the fields need to have conditional visibility or be auto-populated based on formulas, but those are totally within the realm of possibility.
I also edited the map itself. I made the points associated with the monitoring reports invisible, since you will be able to access that data via the related Nests. I also configured the pop-ups, just to display what is within the realm of possibility.
Dynamic text boxes that reference the data
Links to associated reports
A full list of attributes
Graphs, charts, etc
Week Two: August 12 - August 16
Attempted to create another Relationship Class based on GlobalID instead of Nest ID.
Esri recommends “that you add Global IDs to your data and use the Global ID field as the primary key.” In fact, previous errors from Survey123 indicated that the Nest ID relationship type was unsupported because “your layer must have an indexed GlobalID field and all relationships, including attachment tables, must leverage GlobalID fields.”
Created this new parent/child (Nest/Reports) relationship class
Published the new geodatabase to ArcGIS Online
Attempted to create a new survey using the new feature layers…
We’re still getting the same “Unsupported relationship type” error.
In order to fix that, I revisited the relationship class. Other users (here and here and here) found success by creating a new GUID field inside the child attribute table called “parentglobalid.”
GlobalIDs are auto-generated and unique, so the reports themselves will have GlobalIDs (different from that of the Nests). I was struggling to understand how we were then going to use the GlobalIDs to match the Report features up to the Nest features, since the GlobalIDs wouldn’t be the same.
However, by creating this new “parentglobalid” field and leveraging it in the relationship class, the reports now store the parent GlobalID in a separate field. It makes sense then that we could use that to match the reports back up to the Nest feature layer.
Created the new relationship (Nest:globalid > Reports:parentglobalid)
Uploaded new geodatabase to AGOL
Generated new survey using existing feature layer
Published successfully (🎉) with no errors
Note: Survey123 Connect automatically created a new survey folder called “Survey-Form 2” and we learned the hard way that we can’t delete that folder without causing future issues. We may want to revisit the title/configuration of this survey in the future
Moving forward:
The current reports in the Reports feature layer won’t be tied to the Nests feature layer. In other words, the Related Records in the Nests pop-ups won’t (yet) have any results. This is because the “parentglobalid” field is not yet populated with the GlobalIDs of the associated Nests. I may try to go in and fetch those GlobalIDs (or manually edit them) but currently the report features are all orphans.
Also, we will need to configure a component of the survey to auto-populate the “parentglobalid” in future reports. Something like:
User selects nest for which they are creating a monitoring report > ArcGIS fetches that nest’s GlobalID > “parentglobalid” is populated > relationship is linked