Collector feature pushes to Survey123 Form which then conditionally changes symbology in Collector?

1005
13
04-17-2019 10:28 AM
EliasLiakos
New Contributor

I'm trying to create a connection between Collector and Survey123. The basic idea is that we have a series of features available on a layer in Collector, each corresponding to a point we're trying to inspect. When you click on the point/feature it provides a URL which prepopulates some fields in a Survey123 based on the feature's information. I want a field on that Survey123 form to change the symbology of that specific feature on Collector. Is this possible?

0 Kudos
13 Replies
Kara_Shindle
Occasional Contributor III

Did you ever get an answer or figure this out?  I'm also interested in this. 

Thanks

0 Kudos
DougBrowning
MVP Notable Contributor

You could use FeatureSet in Arcade soon.  It does not work right now in Collector but it is going to be added this year.  It works in the webmap now however.

See this post

Are the Arcade FeatureSet functions supported in Collector? 

For more in depth see

https://community.esri.com/thread/243196-dynamic-symbology-based-on-days-passed 

In theory the relationship counts would work if they were related (which is how I do it).  You would use the relationship attributes list...but they do not work in Collector either.  I have never got a response as to why tough.

Relationships Counts not displaying in Collector 

Hope that helps.  I am wanting these also.  Except in my case my users are offline - which means Collector cannot see 123 data until a sync happens.  So I still have no way to check for completeness while in the field.

0 Kudos
DallasCrow
New Contributor III

While FeatureSet expressions aren't yet supported in Collector, they can be used in Attribute Rules on the data you collect. For example, you can trigger a rule on your related table whenever new records are added by Survey123. This rule can create a FeatureSet to grab the related feature's GlobalID, and then update its symbology field through the use of the 'edit' keyword.

It sounds like a lot of work for updating symbology from a related table - but it does the trick, and it can all be done in one calculation.

We have offline workers using a reverse of the above method to get instant visual updates in the field. They survey the features directly to edit the symbology and see their changes while offline. Once their edits sync back to the database, it triggers attribute rules to automatically populate other fields and add a new record to a related table. This method also simplifies the Collector form, in lieu of using Survey123, because we can calculate most fields on the back end.

Here are some resources I found when working on this. I hope they are equally helpful to you:

0 Kudos
DougBrowning
MVP Notable Contributor

This is awesome thanks for posting.  But unfortunately I can get it to work in ArcPro but not in Collector.  Does not work in a AGOL web map either.  (BTW how do you add a related record in AGOL web map).

Does it maybe not work on Hosted Feature Services?  That would be weird but help seems like maybe.  I need to use HFS.

Also found that you have to use $datastore $map does not work.

Any trick to it?

Thanks a lot

0 Kudos
DallasCrow
New Contributor III

Attribute rules can't work on hosted layers (like in ArcGIS Online). To use them in a web map or in Collector, you'll need to publish them to a Portal environment and check the option to reference data instead of copying it. I apologize for not clarifying that in my first post. This link explains sharing with attribute rules.

An alternative for AGOL users is to perform a join between their feature layer and the related table and save the results as a hosted feature view layer. This layer can be used to symbolize the features based on their related surveys. This link describes the process

Here is an excerpt from a story map I made about a previous project that used this method in AGOL. The project was an offline Collector workflow that used Survey123 to write to a related table and symbolized based on related records:

Symbolize Survey Data

To visualize feature points based on surveys in a related table, you can use a hosted feature layer view. This layer provides a dynamic join between your features and their related records.

Open your feature layer in Map Viewer. On your feature layer, select "Perform Analysis" > "Summarize Data" > "Join Features"

  1. Choose target layer: Your feature layer
  2. Choose layer to join to target: Your related table
  3. Select the type of join: Choose the fields to match
    - Target field = GlobalID (use your Primary Key)
    - Join field = GUID (use your Foreign Key)
  4. Choose join operation: Join one to one
  5. Define which record is kept: 
    - Order by: CreationDate (use your read-only editor tracking field)
    - Sort by: Newest
  6. Enable "Create results as hosted feature layer view" and then select "Run Analysis"
  7. The new view layer will appear in the map contents. Open the layer's menu and set the "Refresh Interval" to your desired time. This will determine how quickly new data changes the symbology in your map.

Taking the Map Offline

To take the map offline, all layers must have Sync enabled. The type of view layer described above requires a JSON edit to enable sync. To perform this edit, do the following:

1. Access the view layers service URL

2. Insert "Admin/" between /rest and /services in the URL. 

3. Click the (FeatureServer) link to go back one directory.

4. Scroll down to the bottom and click "Update Definition"

5. Locate this section of code

"editingInfo" : {

"lastEditDate" : 1234567891234

},  

and change the lastEditDate value to "null

"editingInfo" : {

"lastEditDate" : null

},  

6. Locate "syncEnabled" : false,

and set the value to "true"

"syncEnabled" : true,

7. Add the following code to the section immediately after syncEnabled.

"syncCapabilities" : {

"supportsAsync" : true,
"supportsRegisteringExistingData" : true,
"supportsSyncDirectionControl" : true,
"supportsPerLayerSync" : true,
"supportsPerReplicaSync" : true,
"supportsSyncModelNone" : true,
"supportsRollbackOnFailure" : true,
"supportsAttachmentsSyncDirection" : true

},

8. Scroll all the way to the bottom and add "Sync" to the "capabilities" section.

"capabilities" : "Query,Sync", 

9. Change the Format to JSON and click "Update Service Definition"

0 Kudos
DougBrowning
MVP Notable Contributor

Thanks but I need all of this to work in the field on a new feature.  So Add a Field Visit, pull data from the parent, use that data from the parent to launch and pass to Survey123.  If FeatureSet worked I could do it but no.  They say it will be added this year, but they said that last year also, and I am running out of a time.  Only trying FeatureSet because the popup related attributes do not work in Collector either - no response from them as to why.  Plus even with a 1:M going from child to parent it still will only give a count in the web map - it should be able to get the data since it is 1:M.

Still crazy how you cannot access relationship classes in the popup, Arcade, or any other way.  Relationships classes are so powerful but they have such little support.  Should be so simple.

Open to any ideas if you have them.  

Thanks

0 Kudos
DallasCrow
New Contributor III

Please correct me if I'm misunderstanding, but the method above does work in the field when creating new features. Our inspectors created new parent features, clicked a "New Installation" link in the feature's pop-up to pass the data into Survey123, and submitted the results to a related table. The symbology in the view layer would then update based on a field in the newest related record. New features were symbolized using a single value until a survey was submitted, at which point the view layer could visualize over it with unique values. On a side note, even though our relationship class was 1:M, the join analysis still needs to be 1:1 to work correctly.

Are you trying to pass data from the related table into Survey123? We used a pop-up on the view layer itself for this. The view layer pop-up included an "Inspection Form" link that passed recent inspection data back into the survey. In essence, we used one link to create new features, and an identical link on the view layer to add new inspections. The two layers were identified with "Install" and "Inspect" in the titles to make the workflow more intuitive for the field crew. 

0 Kudos
DougBrowning
MVP Notable Contributor

It does not work on Hosted feature services, which for us that means does not work in the field.

Yes I am trying to pass some fields to 123 like usual.  This project is different that the main Point we told them to go to has config values that I need to pass.  But the crew cannot edit that layer and there are multiple visits.  So a crew goes out and creates a new Field Visit record off of the main point - this brings the PointID over to the visit automatically because of the RC.  But I need several fields from the Points layer so i can have all the URLs in the field visit and launch from there.  I cannot launch form the main point since there is some data they need to add first about the site - that I also need to pass. 

In other words I need fields from 2 different feature classes in the URL to pass to 123.  I can do it all in the web map but none of it works in Collector.

Thanks for any ideas.

0 Kudos
DallasCrow
New Contributor III

The need to pass fields from 2 sources is a good use case for this method, and it only works using hosted feature services. The join/hosted feature layer view (we really need a better name for this kind of layer) combines the data from both; it can pass both sets of values into Survey123.

If I am getting this straight, a workflow might be for the crew to first create the first Field Visit as a related record in Collector. A symbol in the join/view layer would then display for that feature with the link to Survey123 in the pop-up. This URL could pass data from both the main feature point and the latest related record, because this layer contains both sets of values. Once there is at least one related record, future Field Visits can be surveyed by following that link. Does this sound any closer to what you're trying to achieve?

0 Kudos