Select to view content in your preferred language

Having trouble creating new relationship class

3246
7
Jump to solution
01-22-2022 04:33 PM
LYELLCS
Emerging Contributor

Hello. I am working on a Survey123 project for my local Park Service. We want to collect information about state historic resources. the data structure is a Site polygon layer, with a related point layer that shows the location of various buildings on the site. There is a lot of data already existing, and I want to build a new survey based on the data.

I am trying to relate the layers in ArcGIS Pro 2.9.1. I am following the instructions in this article "How To: Set up related tables for use in ArcGIS Collector or ArcGIS Field Maps (https://support.esri.com/en/technical-article/000015422)

 

I think I have followed the instructions exactly, but the relationship class doesn't seem to work. I thought setting up the relationship class should automatically assign the GlobalID from Sites to the GUID in Resources, but the GUID remains <null> and there is no relationship between the tables. I tried the procedure using both the point layer and the destination table and using a standalone table created from the point layer.

The common field between the two tables is Site_CRS, but I don't see how to use that information in the relationship class tool. I'm not sure what to try next. 

LYELLCS_0-1642897918953.png

 

 

 

0 Kudos
1 Solution

Accepted Solutions
HuubZwart
Frequent Contributor

You're on the right track, the Create relationship tool is the one you need. If Site_CRS is the common field, that is the one that should be used for the Origin Primary Key and Destination Primary Key fields.

If you want to use GUIDs instead, you need to create these yourself and make sure they match between the tables (you could join the sites to the point features and use field calculator to calculate the correct GUIDs).

I copied the input parameters from the create relationship class tool and filled in for you: 

Origin Table

Your polygon feature class

Table View
Destination Table

Your point feature class

Table View
Output Relationship Class

Output relationship class

Relationship Class
Relationship Type

Either simple or composite based on the required behavior

String
Forward Path Label

A name to uniquely identify the relationship when navigating from the origin table to the destination table.

String
Backward Path label

A name to uniquely identify the relationship when navigating from the destination table to the origin table.

String
Message Direction

The direction in which messages are passed between the origin and destination tables. For example, in a relationship between poles and transformers, when the pole is deleted, it sends a message to its related transformer objects informing them it was deleted.

  • Forward (origin to destination)Messages are passed from the origin to the destination table.
  • Backward (destination to origin)Messages are passed from the destination to the origin table.
  • Both directionsMessages are passed from the origin to the destination table and from the destination to the origin table.
  • None (no messages propagated)No messages passed. This is the default.
String
Cardinality
  • One to many (1:M)Each row or feature in the origin table can be related to one or several rows or features in the destination table.
String
Relationship class is attributed

Unchecked—Indicates the relationship class will not have attributes. This is the default.

Boolean
Origin Primary Key

Your Site_CRS field in the polygon feature class (or its GlobalIDs if you created GUIDs in the point feature class)

String/GlobalID
Origin Foreign Key
Your Site_CRS  field in the point feature class (or the new GUID field if you created GUIDs)String/GUID
 
  

 

View solution in original post

7 Replies
LYELLCS
Emerging Contributor

I don't see how to delete this post, but it is obviously in the wrong location. Since I'm hoping for an answer I have reposted in the ArcGIS Pro location which seems to be the right spot. Sorry if I am doing this wrong.

 

Hello. I am working on a Survey123 project for my local Park Service. We want to collect information about state historic resources. the data structure is a Site polygon layer, with a related point layer that shows the location of various buildings on the site. There is a lot of data already existing, and I want to build a new survey based on the data.

I am trying to relate the layers in ArcGIS Pro 2.9.1. I am following the instructions in this article "How To: Set up related tables for use in ArcGIS Collector or ArcGIS Field Maps (https://support.esri.com/en/technical-article/000015422)

 

I think I have followed the instructions exactly, but the relationship class doesn't seem to work. I thought setting up the relationship class should automatically assign the GlobalID from Sites to the GUID in Resources, but the GUID remains <null> and there is no relationship between the tables. I tried the procedure using both the point layer and the destination table and using a standalone table created from the point layer.

The common field between the two tables is Site_CRS, but I don't see how to use that information in the relationship class tool. I'm not sure what to try next. 

LYELLCS_0-1642869507628.png

 

 

 

0 Kudos
HuubZwart
Frequent Contributor

You're on the right track, the Create relationship tool is the one you need. If Site_CRS is the common field, that is the one that should be used for the Origin Primary Key and Destination Primary Key fields.

If you want to use GUIDs instead, you need to create these yourself and make sure they match between the tables (you could join the sites to the point features and use field calculator to calculate the correct GUIDs).

I copied the input parameters from the create relationship class tool and filled in for you: 

Origin Table

Your polygon feature class

Table View
Destination Table

Your point feature class

Table View
Output Relationship Class

Output relationship class

Relationship Class
Relationship Type

Either simple or composite based on the required behavior

String
Forward Path Label

A name to uniquely identify the relationship when navigating from the origin table to the destination table.

String
Backward Path label

A name to uniquely identify the relationship when navigating from the destination table to the origin table.

String
Message Direction

The direction in which messages are passed between the origin and destination tables. For example, in a relationship between poles and transformers, when the pole is deleted, it sends a message to its related transformer objects informing them it was deleted.

  • Forward (origin to destination)Messages are passed from the origin to the destination table.
  • Backward (destination to origin)Messages are passed from the destination to the origin table.
  • Both directionsMessages are passed from the origin to the destination table and from the destination to the origin table.
  • None (no messages propagated)No messages passed. This is the default.
String
Cardinality
  • One to many (1:M)Each row or feature in the origin table can be related to one or several rows or features in the destination table.
String
Relationship class is attributed

Unchecked—Indicates the relationship class will not have attributes. This is the default.

Boolean
Origin Primary Key

Your Site_CRS field in the polygon feature class (or its GlobalIDs if you created GUIDs in the point feature class)

String/GlobalID
Origin Foreign Key
Your Site_CRS  field in the point feature class (or the new GUID field if you created GUIDs)String/GUID
 
  

 

LYELLCS
Emerging Contributor

Thank-you HuubZwart, your explanation was very helpful. It took me a little while to figure out how to populate the GUID field using joins and calculated field, but once I got that right I was able to create the relationship class, publish to ArcGIS On-Line, and create a survey using Survey123 Connect which properly handled the relationship. Success is sweet!

KateD
by
Occasional Contributor

I am having the same issue. I had my relationship class setup with FacilityID's and I need to switch them to GlobalID's and GUID fields. How do you calculate your GUID field in your related table since I want to keep all of the records we already have collected in the related table. 

0 Kudos
LYELLCS
Emerging Contributor

Kate,

It took me a long time to make this work, so I will share my step by step process. Apologies if it is too simplistic. Note my application wanted to create a one to many relationship between Sites and the Resources located within the sites. My steps refer to the names I created, but you can call your fields whatever makes sense to you.

1. Add the layers to your map. If necessary, use the copy features tool to create editable layers in the .gdb

2. Create a new field in Sites attribute table (your Origin layer) called TempGlobalID (field type TEXT)

3. Calculate the value: TempGlobalID = GlobalID (of Sites)

4. Create a new field in Resources attribute table (your Destination layer)  called Site_GUID (field type GUID)

5.Use the Join tool to add TempGlobalID to the Resources layer, using the linking field SiteID (in your case FacilityID) as the join field. [Note: At this stage I tried repeatedly to perform the calculation in step 6, but it didn't work. Not sure if the problem is my computer set up, or a real bug, but when I saved the map, exited completely from ArcGIS Pro and re-opened the map it worked.]

6. Calculate field value: Site_GUID = TempGlobalID

7. Clean up the data: Delete unneeded fields such as TempGlobalID and remove the join.

8. Create new relationship class as outlined in HuubZwart's excellent post above.

Good Luck!

Steve_Moore76
Emerging Contributor

Hi, I've got a very similar problem. I'm following an ESRI tutorial

"Explore a many-to-many relationship class"

- Data Management - September 12, 2022

-by: Dana Muresan

They tell you to use the "Table to relationship class" tool which is very similar to this tool. My problem is that the tool appears to work in that it creates a relationship class file in the output geodatabase, but when you examine the newly linked tables the relate doesn't seem to have done anything and no tables are really linked. I've tried and tried to be very careful following the tutorial and repeated it many times with the same results. Nothing! I'm using Pro version 3.1.3 by the way.

0 Kudos
AmyHut
by
Emerging Contributor

I don't have a solution to recommend, but am here to commiserate. I'm working through this tutorial as well and having the same experience -- Table to relationship class tool appears to work, there is a relationship class file in the output geodatabase, the properties appear correct, but when I select a feature, there is no related data. I'm using 3.3.2. 

Did you ever find a solution?

0 Kudos