Related Tables in AGOL

5139
12
10-10-2019 10:45 AM
CynthiaKozma
Occasional Contributor II

I have created an AGOL web map for a sewer district from a Sanitary Sewer solution, and they are using the Web Map in Collector to update their utilities.  One of the features that they are updating is manholes.  They want to add a date field to the table of when it was inspected and then be able to keep a record of all inspection dates.  So, this would probably mean having a related table with a one to many relationship.  Is it possible to create a new related table and add it to an existing web map and feature layer?  If so, how do you go about that?  Thanks for any help.

12 Replies
TimMinter
Occasional Contributor III

I need the same capability.  Generically, I need for any ArcGIS Enterprise and ArcGIS Online creator accounts to be able to design and add a table, establish a 1-to-many relationship from an existing feature class that has been shared to them to the table, and then edit their table as needed.

I haven't found a way to do it yet, either.  If there's a way, I'd love to know about it.

tim

JamesCrandall
MVP Frequent Contributor

I guess it may depend upon how the original service was published.  

1. If it was designed and published from an mxd to AGOL as a hosted feature service then perhaps setup the relationship class and republish.  I would think the hosted item would be overwritten with the new design.

2. If it was created in AGOL then perhaps you would need to update the JSON of that item directly.  Definitely a trickier proposition but maybe one workflow that could potentially work is:

  • Publish a brand new service to AGOL with the desired design.
  • Use AGO Assistant to copy down the JSON of that new service.
  • Use AGO Assistant to edit the JSON original service and paste in the JSON from the new service.

This is likely full of pitfalls and trials that would be fun to figure out. 

0 Kudos
by Anonymous User
Not applicable

Hi All,

This functionality is possible through the Rest API - this thread goes over it: Adding related table to ArcGIS Online feature layer 

I can see wanting to do this through the GUI though - there is an ArcGIS Idea for this here (it was marked as a duplicate but isn't any longer): https://community.esri.com/ideas/11754 

Hope this helps,

-Peter

0 Kudos
CynthiaKozma
Occasional Contributor II

This looks promising.  So, right now, I have a SanitarySewerNetwork with manholes being one of the feature layers within there.  If I open the JSON of the manholes, I see where you can add a relationship.  I also have an .xls table that I added to my content that would hold inspection dates, condition, etc.  Am I on the right track in that I can set up a relationship between the manhole feature layer and the excel table?  Or does the table need to be in a different form?  I'm not sure what the 'RelatedTableID' would be.  Any Ideas?

0 Kudos
by Anonymous User
Not applicable

Hi Cynthia Kozma‌,

The catch to the above workflow is that the table must already exist in the same Feature Service. So for example, you need to have layer ID 0 (the Feature Layer) and layer ID 1 (the layer/table that you want to related to the feature layer) within the same service. This wasn't immediately clear from my initial comment and I am now realizing that it doesn't exactly accomplish the end goal of the workflow.

Is there existing data in the feature layer right now?

What you may want to ultimately do is create a new service that includes the related table and then append existing records from the old service into the new. 

I hope this helps,

-Peter

0 Kudos
KellyArmstrong
Occasional Contributor II

Currently, ESRI has no out of the box solution for selecting multiple features and adding a related record to each feature.  Seems crazy, but yes...not possible.  So, if I want to add flushing services to all 1500 hydrants, I have to click on each hydrant and add a service - 1,500 times, instead of being able to just select all the hydrants and batch add a related record.  

0 Kudos
by Anonymous User
Not applicable

Hi Kelly,

Thanks for the post here, I noticed that you up-voted this idea too Add Multiple Related Records and got your account attached to an enhancement through Support. Reading through the enhancement (ENH-000111903 - Add the option to edit related records in the Batch Attribute Editor Widget in Web AppBuilder), it mentions bulk-updating of related records but not bulk-adding. It doesn't sound like this is the functionality you're looking for and I apologize for this mix-up. 

I created a request specifically for bulk-adding related related records: ENH-000131175 - Provide a widget that enables batch adding related records. Let me know and I can attach your customer number to this enhancement from my end. 

-Peter

KellyArmstrong
Occasional Contributor II

Thanks Peter.  Customer #22197

by Anonymous User
Not applicable

Thanks Kelly - your account is attached. 

0 Kudos