Collector: use related layer to symbolise feature

23926
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.

51 Replies
JerryCorum1
New Contributor III

Database Management tools are: SQL Developer Studio for Oracle, Microsoft SQL Server Management Studio for SQL, PgAdmin III for PostgreSQL.  They are the tools provided by the database software for managing the database.

I am no longer using the views - the performance of the views was very slow.

In Oracle, with "in" statements like mine, if I had hard coded values like this:

SELECT * 
FROM myTable
WHERE value in (1,2,3...1001);‍‍‍

It would not have worked, because oracle only allows 1000 values in such a statement, but selecting values in another table is fine.  You probably don't need to worry about this but it has caused issues for me in the past so I wanted to make sure to share it.

Do you have multiple inspections in your inspection table for one manhole?  From what I can tell it looks like you have duplicate ParentGUIDs in your related table - you'll need a way to only look at current or active ones.  I do this in my tables with the "ACTIVE = 'YES'", that way old contact information (no longer 'active') isn't a factor.

AndresCastillo
MVP Regular Contributor

By the way, thank you very much for specifying how to denote a versioned table in sql.

Since I can only show the current record, then I would have to include in the definition query the ability to pick the latest inspection date (which is updated using the editor tracking create date field, named 'InsStart') per unique foreign key (Parent GUID).

These thread talk about this, but I would like help to put it into context.

https://community.esri.com/thread/90206

https://community.esri.com/thread/194907-select-records-with-most-recent-date-for-groups-of-points

How would I verify I end up with the desired query?

0 Kudos
JerryCorum1
New Contributor III

I'm happy I can help a little!

As for verifying your query that one is tough no matter what because you're going to need to verify the correct number of records.  If you are able to have the data maintainers verify, that is always good because no one will know the data better, maybe they even have an SSRS report or something similar from another system that can give you the correct number of records you should be looking for in your query.  You will really need to learn the data well if you want to be sure of your SQL query results (this is true across the board with any data you'll ever interact with and build systems to update).  If you have a DBA who is good with SQL you might reach out to them for good resources and help!

Good Luck!

0 Kudos
AndresCastillo
MVP Regular Contributor

Yes, you are right.

I suppose the correct query will yield 4292 records, but the query should return the records with the latest date per ParentGUID, instead of  returning only the first matching record. 

In order to verify the expected count, I used the summary statistics tool on max date, case field guid.

0 Kudos
AndresCastillo
MVP Regular Contributor

At this time, I will branch here:

https://community.esri.com/message/773010-symbolizing-feature-class-using-related-table-values

Thank you again Jerry Corum!

0 Kudos
AndresCastillo
MVP Regular Contributor

My DBA and I came up with this:

SELECT ParentGUID AS 'Parent_GUID', CONCAT(CONVERT(nvarchar(30), MAX(InsStart), 110), ' ', CONVERT(nvarchar(30), MAX(InsStart), 108)) AS 'Inspection_Date_Time' FROM [sde].[SSMANHOLEINSPECTIONSHISTORY_EVW] GROUP BY ParentGUID 

Create Database view gp tool on the SSMANHOLEINSPECTIONSHISTORY_EVW table. Join the view to the parent fc, matching records only, using the Parent Global ID/Child GUID as the join fields Then also join the SSMANHOLEINSPECTIONSHISTORY_EVW table to the parent fc, matching records only, using the Parent Global ID/Child GUID as the join fields Add the parent fc several times to perform the same operations to symbolize based on field categories, using the same view and same table.

I do notice the slow performance you were talking about with views, which is why I'd rather do this within arcmap as a definition query on the parent point fc layer itself, using something similar to the subquery you mentioned like this:

SELECT * FROM ssManholeInspections WHERE:
GlobalID IN (SELECT ParentGUID from ssManholeInspectionsHistory)

Any other thoughts?

0 Kudos
ShaunGibbins2
New Contributor III

Are you able to actually publish this as an editable feature service to use with ArcGIS collector and take it offline?

0 Kudos
AndresCastillo
MVP Regular Contributor

I haven't tried to publish yet.

I will post what I end up doing as soon as I can.

0 Kudos
ShaunGibbins2
New Contributor III

the reason I asked was because when I was trying to find a solution to this I tried a load of different approaches, definition querys, views, labels etc all of which worked fine in ArcMap or pro but none of it worked as required in collector once published.

Its been awhile since testing mind so very interested to see how you get on. 

AndresCastillo
MVP Regular Contributor

Can you share what you tried that worked?

0 Kudos