How to symbolize which features have attachments?

11663
15
11-19-2014 02:35 AM
TuridBrox
Occasional Contributor

Does anyone know if it's possible to symbolize which features have an attachment? I have a point feature class with an attachment table containing pictures. Only some of the points have attached pictures. I'd like to show with different symbols in the map which features have attachments and which have not.

So far, the best I've come up with is to join the feature class and the attachment table, and to symbolise on one of the attributes in the attachment table. Where the attribute is <null>, there is no attachment. This is not a good solution, because the join seems to make it impossible for me to add new attachments to the feature class. I have therefore exported the table containing the join, but that means the symbology is static.

15 Replies
NeilAyres
MVP Alum

And I also had to wrap my update in an editing session.

NatCarter
New Contributor III

If you do a Join between the Feature Class and the Attachement table to identify which features have attachments or not the resultant layer will not expose the attachments when using the Identify tool.  This means we can symbolize them as needed but we loose the functionality of retrieving the one or many attachments since a join is a one-to-one and attachments are a one-to-many relationship.

Xander has a good process to identify those features that have attachments and make note of it in a new field in the feature class but this is a job that needs to be run after every edit or built into a users workflow.

An on the fly way to accomplish the symbology we are after without extra fields and jobs to calculate those fields is to leverage the layer's definition query.  ESRI's documentation refers to this as a Subquery when you build a definition query for a layer that has to do with data from another feature class or table.  Try using this syntax to complete the SQL statement in the Definition Query property of your layer to filter its records based on the presence or absence of attachments.  In this example Global ID in the Feature Class is used as the foreign key in the Attachment Table.

Feature with Attachments = GLOBALID IN (SELECT REL_GLOBALID FROM <your attachment table>)

Feature without Attachments = GLOBALID NOT IN (SELECT REL_GLOBALID FROM <your attachment table>)

RegistruConstanta
New Contributor

In my case i just make a new join between the feature layer and the attachment using the OBJECTID field and the REL_OBJECTID field and i want to keep all the records. Those with matching will be the ones with attachments and those with <null> will be without. 

Hope this will help someone

0 Kudos
ThomasFurcron
Occasional Contributor

I had a similar issue, where I was trying to determin which features had an attachment, but I think the solution will work here as well.  

With in the defintion query of the feature class you can define that you only want those with attachments and then symblogize those differently.  You can do this using 

OBJECTID in (Select REL_OBJECTID FROM featureclass__ATTACH where DATA_SIZE > 0)

This can be used to make a selection or in the defintion query to only show those with attachments, it can also be used to make selections based on any related table. 

Good luck. 

Tom 

XanderBakker
Esri Esteemed Contributor
ChadBunn1
New Contributor III

This worked perfectly for me thank you!