Query features based on its related data

2924
7
Jump to solution
11-01-2015 01:42 PM
HaniDraidi
Occasional Contributor II

Is there a way to query features based on its related data (using relationship class, NOT join or relate)?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

It is difficult to elaborate more than the precursor to the table...

  • Relationship classes help ensure referential integrity. For example, the deletion or modification of one feature could delete or alter a related feature. Furthermore, a relationship class is stored in the geodatabase, which makes it accessible to anyone who uses the geodatabase.
  • On-the-fly relationships, also called relates, are defined as a property of an ArcMap layer. Use them for improved editing performance.
  • Joins are best suited for labeling and symbology. You define joins through the relational database to make standard SQL queries cross the database as well as a variety of data sources.

I am not sure of your purpose, but you will have to read the rest of the help tree

http://desktop.arcgis.com/en/desktop/latest/manage-data/relationships/benefits-of-relationship-class...

to see if what you want to do is feasible.  It may or may not be permissible so you will have to decide what is the most important functionality.

View solution in original post

7 Replies
DanPatterson_Retired
MVP Emeritus

see the pros and cons table here Deciding between relationship classes, relates, and joins—Help | ArcGIS for Desktop apparently a big no for sql queries and symbology

0 Kudos
HaniDraidi
Occasional Contributor II

Thanks for the reference Dan,

Due to the 1-many cardinality that I have, seems that I should choose between the relate and the relationship class, and referring to the pros and cons table, seems that relate needs a join to enable the query and symbology (In the screenshot below). Actually, I could not understand this point. may you please elaborate it more?

Clip_1220.jpg

0 Kudos
DanPatterson_Retired
MVP Emeritus

It is difficult to elaborate more than the precursor to the table...

  • Relationship classes help ensure referential integrity. For example, the deletion or modification of one feature could delete or alter a related feature. Furthermore, a relationship class is stored in the geodatabase, which makes it accessible to anyone who uses the geodatabase.
  • On-the-fly relationships, also called relates, are defined as a property of an ArcMap layer. Use them for improved editing performance.
  • Joins are best suited for labeling and symbology. You define joins through the relational database to make standard SQL queries cross the database as well as a variety of data sources.

I am not sure of your purpose, but you will have to read the rest of the help tree

http://desktop.arcgis.com/en/desktop/latest/manage-data/relationships/benefits-of-relationship-class...

to see if what you want to do is feasible.  It may or may not be permissible so you will have to decide what is the most important functionality.

HaniDraidi
Occasional Contributor II

Thanks for the helpful link Dan,

According to the help-page mentioned above, there is a benefit from using relationship class which is:

  • Relationship classes allow you to query related features and records. Similar to an ArcMap join, you can query, perform analysis, and generate reports with attributes from a related class.

I don't know if this means that I can query my features based on its related? What do you think Dan?

Best Regards,

Clip_1221.jpg

0 Kudos
DanPatterson_Retired
MVP Emeritus

Are you adverse to trying it yourself if you already have an example set up?

0 Kudos
HaniDraidi
Occasional Contributor II

Hi Dan,

Thanks for the valuable contribution,

My example is: I have parcels feature class, these parcels are related to valuation table (each parcel has a certain valuation each year), and the estimation table is related to another table which is the the owners table that includes the owners for each parcel in each year, and I want to apply a query on the owners table that finds the related parcels. E.g. I want to search for "Dan" in the owners table, and after I find it, I want to view your parcels.

I tried this in ArcMap and it worked! I just got confused because in the reference you mentioned, it is stated that this is possible (and actually it is possible). However, you mentioned in your first reply that this is NOT possible.

Best Regards,

0 Kudos
JoeBorgione
MVP Emeritus

I'm with Dan on his last post; sometimes you just gotta give it a go. 

I will however provide you an example of a query I perform via a 1-many relationship class:  I maintain a point feature class of business names and it has a relationship with an alternate names table.  When I have business names with the same 'root' name (think 7-11) the points are named 7-11<CityCode>  where <CityCode> is a three letter City abbreviation.  There are dozens of 7-11s in my area of operation and the points are named like this:

7-11 WVC

7-11 COT

7-11 SJC

etc

Each one has a related record in the Alternate Names table where the name is simply 7-11.  If I query the Altername Names table for "Name ='7-11' and then select the related tables tab, I'll get all of them.  Make sense?  This is actually a 1-1 example, but it works for all my alternate names.  For example I have three points:

Joes Crabshack

Joes Bar And Grill

Joes Tool and Die

Since all of them have a related entry of Joes I can query for that.  Or if I'm looking for a beer and a burger I can query for Joes Bar and get the desired result of Joes Bar and Grill....

That should just about do it....