Let’s talk about relationships – in Collector

26th June 2017

Collector for ArcGIS is great for adding new features and editing existing information. For most, this is sufficient, but what if you need to add new information repeatedly without losing any original data? This is where related tables come in.

What are related tables?

A related table is a second table that sits alongside your original data table. Records created in this second table are associated with the original table through a common unique field, known as a Key. The original table has a Primary Key, and the second table has a Foreign Key. When a new entry is made in the second – related – table, the Primary Key value is passed to the Foreign Key.

A practical example

I’m a Park Manager with an inventory of trees I need to monitor annually, to assess their health and stability, and I want to use Collector to achieve this. I already have a map in Collector with all my trees providing basic information on species, dimensions and age. I could add fields to this dataset for health and stability information, however this would cause an issue the following year when I update my assessment and lose previous information. It would be useful to have a collection of assessments over time instead for each tree. Related tables can achieve this.

Creating related tables in Pro

In ArcGIS Pro, I have my ‘Trees’ dataset with the below fields. The most important field is Tree ID which is going to be my Primary Key. This is a unique identifier for each tree in the park. If you don’t have a unique field for your records, you could enable Global IDs and use them as the Primary Key.

I’ve also created a new table in my geodatabase called ‘Assessment’ which will be my related table. This has the same Tree ID field which will be the Foreign Key. If you’re using a Global ID as the Primary Key, the Foreign Key needs to have a GUID data type.

I can create a relationship between my Trees and Assessment tables by right clicking on the geodatabase they belong to and choosing New > Relationship.

I’ve then used the following parameters for the relationship, with the Cardinality set to One to many (1:M).  This means that for each tree, I can have multiple assessments, allowing me to build an assessment history over time. When complete, you will see a Relationship Class in your geodatabase.

Now all I need to do is share this to my ArcGIS Online account – Collector will honor the relationship created in ArcGIS Pro. Optionally, you can enable attachments for the related table in the Item Details page so you can add photos for each assessment.

Using related tables in Collector

To add a new assessment, I need to click on a tree in Collector and open its details. I can see all the basic information I already have on that tree and below this is my Assessment table, with two options – View and New.

Clicking on New takes me to my related table, where I can add information for this year’s assessment. This works in the same way as other data collection in Collector, also supporting domains. When submitted, I can view the assessment from the details page by clicking on View.

The next year I can add a new assessment in the same way. I can then view assessments over time, each having a record in the related table that is associated with the same tree. All this whilst maintaining all the original information stored in my Trees feature class.

With related tables in Collector for ArcGIS, you can quickly and easily build up historical records for your data while maintaining key information. For more information on related tables, visit here.