Can't add relationship class to map?

2699
5
Jump to solution
07-28-2021 07:18 AM
E_A_Bloomquist
New Contributor II

Hi all,

I'm trying to include a relationship class in a map, so it'll be included when I publish the map to AGOL as a hosted feature layer.  But when I right-click on the relationship class in the ArcGIS Pro catalog, the "Add To Current Map" option is grayed out.

Anybody have any ideas about what I might be doing wrong?  Is there some detail about creating the relationship class that I might have missed?   The layers referenced in the relationship class are already in the map.

Edited to add:  When I try to just drag the relationship class from the catalog to the map, it says "Failed to add data ... The table was not found".

Thanks.

0 Kudos
1 Solution

Accepted Solutions
RPGIS
by
Occasional Contributor III

No, it is something that is honored despite not being able to directly see the relationship that you created in the map. If you already have the features that participate in the relationship in the map currently, then you should be able to test it by selecting the feature and viewing the attributes. It should look something like this:

Example AGO.JPG

The relationship is stored in the database; it is something that cannot be added to the map directly.

View solution in original post

5 Replies
RPGIS
by
Occasional Contributor III

Typically when you create a relationship class, you would add both tables/features to the map for publishing. I've done this on multiple occasions.

I don't know how your relationship is set up, but depending on how it is setup, you will need to add all of the tables/features that participate in that relationship(s).

For instance, I have a sample where I have multiple features relating to a single standalone table.

  • All of the features plus the standalone table are brought into a single map.
  • From the standalone map, I publish everything as is (the relationship will still be honored despite the user not seeing it).

So doing this should give you what you need.

E_A_Bloomquist
New Contributor II

Both of the feature layers the relationship class was created with were already in the map.  Don't I need to add the created relationship class to the map as well?  That's where I'm running into an issue.  

When I right-click on the relationship class in the catalog, the "Add To Current Map" option is grayed out.  (The "Add To New" submenu is there, but all of the options under that submenu are grayed out.)

And as noted, trying to simply drag the relationship class to the map fails as well - "The table was not found".


0 Kudos
RPGIS
by
Occasional Contributor III

No, it is something that is honored despite not being able to directly see the relationship that you created in the map. If you already have the features that participate in the relationship in the map currently, then you should be able to test it by selecting the feature and viewing the attributes. It should look something like this:

Example AGO.JPG

The relationship is stored in the database; it is something that cannot be added to the map directly.

E_A_Bloomquist
New Contributor II

Okay, I see now that the relationship does follow when published to a web layer on AGOL.  

Thank you.

0 Kudos
MelissaJarman
Esri Contributor

I can understand why it would be confusing when only 'some' relationship classes have this context menu to add to map. Only certain types of relationship classes will have the right-click context menu to add to a map. Many-to-many relationship classes have an intermediate table and will have the context menu to add to the map - they'll show up as tables. These are also referred to as attributed relationship classes.

Here is some supporting documentation for preparing data that mentions attributed relationship classes needing to be present in the map document.

Prepare data to publish a feature service

  • Feature services allow queries on related data, but only if the relationship is defined through a geodatabase relationship class. If a published map document has a layer and table related through a geodatabase relationship class, the feature service allows queries on the layer to return objects from the related table. To support queries that return related objects, you must include the table and layer involved in the relationship class in the published map document. If either the origin or destination layer or table is not included in the map document, the feature service ignores the relationship.
    Note:

    For attributed relationship classes, include the relationship class table in the map document.

0 Kudos