Collector: use related layer to symbolise feature

21246
51
Jump to solution
09-04-2015 10:40 AM
ShaunGibbins2
New Contributor III

In the post below it describes using ArcGIS Collector to carry out inspections of assets by creating a relationship to an inspection table. This works really well and is a good way to separate asset edits from maintenance operations, however I cannot work out how to update the symbology to display when an asset has had an inspection.

Related Tables – Exploring New Ways to use Collector for ArcGIS | ArcGIS Blog

If you have a large number of assets then you need a method for the field works to keep track of what has been inspected and what is still due, I originally thought of having a 'inspection_status' field that would be set at the start of the season to 'Due' and would have a default setting of 'Not Due' so that every time an inspection took place the field value would automatically change from 'Due' to 'Not Due' without the field worker having to do anything other than fill in their inspection form.

I was then going use the icons below depending on which value the feature had for 'inspection_status' The only problem is that this field is in the inspection table and not accessible from the feature class to use to set the symbology!!!! Arrrgh

YellowEmpty.png Due

Yellow.png Not Due

Does anyone know another way to achieve the same result please or could this be considered for a future enhancement.

1 Solution

Accepted Solutions
JerryCorum1
New Contributor III

I ran into this problem recently -

I created a view through ArcCatalog that joined my related table to my feature class, but with simplified attributes (not using all of them, this was just for visuals).  I then published this view as a map service.

Publish your Feature Service with the editable feature class and related table normally.

Then add both to your map!  Remove popups on the map service for the view, and your Collector edits will change the symbology!  It does require you to move the map around a little though to get it to refresh, but if you are setup with Operations Dashboard, those updates show up within seconds. 

View solution in original post

51 Replies
RandyBurton
MVP Regular Contributor

Since I have the same question, I was hoping you would get an answer.

I think the symbology could only be part of the feature and not in the related table because of a one to many relationship.  So when a user completes the form part in the related table, they would need to reset the symbology flag in the feature.

As an alternative, it may be possible to access the REST API via a Python script to query the related table to see if a form had been completed within a specified time period. If a form meets the criteria, then the script would make an update to the feature’s symbol indicating “not due”. Likewise, if a related form is found to be out of date, then the feature’s symbol could be changed to “due”.

ShaunGibbins2
New Contributor III

Hi Randy

My problem is my crews are used to seeing an icon update the second they update an asset, we have been using a third party iOS app for gully emptying which does exactly that but it is a one trick pony and I have other assets to attend to. There would be some delay if using a script to update an attribute.

What I almost got to work was using labels instead of symbology to highlight an asset using a query based on the last edit date so my intention was to set a field as a inspection start date and use > last edit to set the label I even managed to get the label to display the icon I was a after but when you go to add the feature service to the arcGIS online map for collector to use the service drops the bloody labels, they work if adding as a MapServer which is no good for collector but not when added as a FeatureServer. So close lol.

Looks like I'll have to nag my Esri rep to get some sort of enhancement implemented!

PaulCone
New Contributor III

I have written a Python script to do exactly this, for post-earthquake building safety inspections.  Yes, you can't use a field on the feature because of the one to many relationship.  I have a layer that is used just for symbology on the map and it not editable in Collector.  It runs in a loop.  Here are the steps.

# Queries AGOL service for new ATC-20 building inspection records collected with ArcGIS Collector.

# Adds new inspections to table in local geodatabase.

# Updates inspections with precalculated lat/long values from building footprints.

# Downloads photos attached to inspection records and adds them to geodatabase.

# Updates inspected buildings layer on AGOL feature service.

Paul

-------------------------------------------

Paul Cone

Corporate GIS

Bureau of Technology Services

City of Portland, Oregon

paul.cone@portlandoregon.gov

JoshuaCarver-Brown1
New Contributor III

Hi Paul,

Was this symbology update also functional when Collector was disconnected? I've created a script similar to yours in that the feature updates based on the related table. However, I'm cannot figure out how to drive this symbology change when not connected to our services.

Thanks,

Josh

0 Kudos
AndresCastillo
MVP Regular Contributor

Can you share your script to see more details?

JerryCorum1
New Contributor III

I ran into this problem recently -

I created a view through ArcCatalog that joined my related table to my feature class, but with simplified attributes (not using all of them, this was just for visuals).  I then published this view as a map service.

Publish your Feature Service with the editable feature class and related table normally.

Then add both to your map!  Remove popups on the map service for the view, and your Collector edits will change the symbology!  It does require you to move the map around a little though to get it to refresh, but if you are setup with Operations Dashboard, those updates show up within seconds. 

View solution in original post

AndresCastillo
MVP Regular Contributor

Can you expand on making a view?

Do you mean to use the 'make table view' tool?

0 Kudos
JerryCorum1
New Contributor III

Sure!  I don't use the GP tool, but you could.  More info here: Create Database View in ArcGIS Desktop  I usually use the database management tools to prototype the view's SQL Script and then use ArcCatalog to create the actual view, however I've recently revisited this problem and changed my approach entirely. 

I have a feature class of addresses, and a related table of what is essentially contact information.  The contact data in the related table are updated with 4 options from the web app front end: Contacted, Not Contacted, Attempted, and Other.  To symbolize the address layer by what's in the related tables I added the address layer to my Table of Contents 4 times, and used separate definition queries for each one (renaming them to match the query used). 

Table of Contents showing 4 layers

The definition query is just the "WHERE" clause of a SQL expression, which means you can select from other tables in your Enterprise Geodatabase easily.  for example my "Not Contacted" layer's definition query looks like this:

EID in (SELECT EID from PS.CANVASS_FIRE_EVW where ACTIVE = 'Yes' and CONTACTED = 3) 

Our EID is a GUID, so you could use Esri's Global IDs for this as well (and that would be better, I'm just working with some real legacy data).  What's happening here is I am selecting only the features in my address feature class with a unique identifier (EID) that is also in the related table (PS.CANVASS_FIRE), is ACTIVE, and has the CONTACTED status I am looking for (3 in this case is Not Contacted).  This nicely gets around Oracle's 1,000 value limit for "in" statements as well by using the related table for the values.  If your related table is versioned you need to use the versioned view (indicated with the _evw and created by SDE automatically when you version a table or feature class).  This allows your symbology to be updated live as the data is updated, rather than after a compress.

AndresCastillo
MVP Regular Contributor
Thank you for your reply.
This seems like a beautiful solution.
Please explain what you mean
"I usually use the database management tools to prototype the view's SQL Script"
What are the database management tools?
Also, are you not using views anymore?
Please explain what you mean
"This nicely gets around Oracle's 1,000 value limit for "in" statements as well by using the related table for the values"
Does this mean that your related records per category are each less than 1000 values?

I have a manhole inspections fc, related to a inspection history table, using the Parent's 'GlobalID' field (aka gid)/ and Child's 'Parent guid' field in a one to many relationship,
and the table has attachments using gid/Parent guid.

 

I am trying to symbolize the parent feature class based off fields from the child table.

 

So far, I've attempted two methods:

 

1.
I attempted the sql script from the FC in arcmap using this definition query:
SELECT * FROM ssManholeInspections WHERE:
GlobalID IN (SELECT ParentGUID from ssManholeInspectionsHistory)

The resulting fc ends up with 4292 records, even though the inspection history table has 4665 records.
2.
Joining the table to the fc also results in 4292 records, with the 'Validate Join' Button producing a Join Validation Report
Dialog window that says:
The number of matching records for the join:
- 4292 of 7454 records matched by joining [GlobalID] from <ssManholeInspections> with [ParentGUID] from <ssManholeInspectionsHistory>.
Matching records may not appear in table view due to join validation errors.
Cardinality Warning:
Join Validation detected 4665 non-distinct matching records when using [GlobalID] from <ssManholeInspections> with [ParentGUID] from <ssManholeInspectionsHistory>.  For geodatabase data, ArcMap will join all matching records, although only the first matching record will be displayed in the attribute table of <ssManholeInspections>.  This relationship is 1:Many or Many:Many. When working with 1:M and M:M relationships, it is recommended that relates or Relationship Classes be used instead of joins.  Refer to the ArcGIS Desktop Help topic: About joining and relating tables for best practices on creating relationships between tables.
It is fine that 7454 records did not join because not all manholes have been inspected yet.
0 Kudos