Related Tables in AGOL

5150
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
KevinMacLeodCAI
Occasional Contributor II

@Anonymous User  Greetings! We have the exact same situation. Existing street sign hosted feature layer in AGOL. (and several other layers)  The Town now said they want to start tracking inspections and repairs. So, we'll need a related table. It would be great if one could just create a table with the "Create" button (one which supports adding records, btw). (Feature Enhancement #1)  And then create a Relate (Feature Enhancement #2) all on AGOL. 

 

Is the only way to add a Relate to an existing hosted feature class still to do your workflow? Here is the only way I can think of:

1. Download the data locally via Pro.

2. Create an inspection table and then Relate it locally with Pro

3. Upload it to AGOL. 

4.  Either replace all the existing layers with this new one in all web maps... Or... could I use Overwrite Web Layer in Pro?  

Or I'd also be ok with using the Assistant and editing JSON although only if it is well documented. I'm not entirely following what it entails above.

0 Kudos
by Anonymous User
Not applicable

Hi @KevinMacLeodCAI - in your case the workflow you list is the method to use. The reason for this is that to add the relationship class via the Rest API, the table (or other layer that you want to related as the M in the 1:M relationship class) must already exist in the service. 

I would not use Overwrite Web Layer in this case because you are adding a table to the hosted feature layer. This means that web maps would not have this table in their JSON and wouldn't pick it up in the overwritten layer. I gave this a quick test to confirm it. So you will want to publish a new layer and replace the existing layer with your new layer in web maps. 

I hope this helps!

-Peter

KevinMacLeodCAI
Occasional Contributor II

Thank you Peter, that makes sense. Of course republishing can have other adverse effects so I try to avoid that until it's needed in general.

0 Kudos