Overwrite a Feature Service used in Join Features as Hosted Feature Layer Views

3302
35
Jump to solution
02-01-2019 03:57 AM
AnthonyJones5
Occasional Contributor

I recently read the article from Paul Barker titled Bring your data closer together: Save analysis results from Join Features as Hosted Feature Layer Vi.... This is a really useful feature but I'm having trouble overwriting my feature services that are used in the join, where a hosted view is created. In the post Paul mentions that "feature layers that participate in view layers with joins cannot have their schema altered and are always read-only and cannot be used offline.". Does the feature layer being read only mean that it can't be overwritten?

Whenever I try and overwrite my feature service in Pro it simply says Failed to publish web layer. I then find that the data tab for my hosted view just says Data Error. Note that when I'm trying to overwrite my feature service the schema is exactly the same.

It would be a shame if this can't be done as one of my features used in the join is updated on a weekly basis so overwriting is the best way to keep this up to date online.

Any help with this would be much appreciated.

Thanks

Anthony

0 Kudos
1 Solution

Accepted Solutions
KhaledHassen
Esri Contributor

Yes this is currently a limitation in publishing with overwrite. Online team will work in removing this limitation in the next release or so.

But I think we might need to consider using Append API with upsert capability. This where you get a chance to insert new data or update existing data from different sources based on the use of a unique column in the destination layer. Actually this is a better solution that keep overwriting your data from the same source regularly. 

Once you use append and update the source, existing views should continue working and picking up the new changes in the source data.

Thanks

Khaled Hassen

View solution in original post

0 Kudos
35 Replies
KhaledHassen
Esri Contributor

Yes this is currently a limitation in publishing with overwrite. Online team will work in removing this limitation in the next release or so.

But I think we might need to consider using Append API with upsert capability. This where you get a chance to insert new data or update existing data from different sources based on the use of a unique column in the destination layer. Actually this is a better solution that keep overwriting your data from the same source regularly. 

Once you use append and update the source, existing views should continue working and picking up the new changes in the source data.

Thanks

Khaled Hassen

0 Kudos
AnthonyJones5
Occasional Contributor

Thanks for the response on this Khaled, it's good to know that this limitation may be removed in a future update.

So is there anyway to overwrite existing data based on a unique column in Pro at the moment? As a workaround I had thought to just try a join and then overwrite fields on the feature service in Pro but find that as my feature has nearly 80,000 records then this is extremely slow. I'm not a developer so am not familiar with the ArcGIS API so is the upsert capability currently available in any of the geoprocessing tools in Pro?

Thanks

Anthony

0 Kudos
AnthonyJones5
Occasional Contributor

Hi Khaled,

It's been a few years since I enquired about the ability to overwrite layers used in a feature layer view join. At the time you suggested this was something being looked into. Do you know if this is a limitation that is likely to be fixed? Being able to regularly overwrite layers used in a  join would be very useful.

Kind Regards

Anthony

0 Kudos
KrisRobbins2
New Contributor

I'm looking for a work around for this exact same issue.  I have a script to automatically overwrite a csv table that is joined via a view to a feature layer.  As soon as the view is created, the overwrite option is eliminated and my script will no longer run.  

0 Kudos
AnthonyJones5
Occasional Contributor

Hi Kris, I did find a work around to this courtesy of Jake Skinner using python to truncate and append my data rather than overwriting this. I'm a complete beginner with python but I was able to update the script and then schedule it to run by adding it as a script to an arc tool box and running it from ArcGIS Pro. Have just tested it today with my layer in a join online and everything seems to have been maintained. Takes about 18 minutes to update 200,000 records. Hope that helps.

0 Kudos
KrisRobbins2
New Contributor

Thanks for the info Anthony.  Any tips on getting the script to work for you?  I only need to update 46 records but it needs to run every 30 min.  

0 Kudos
AnthonyJones5
Occasional Contributor

Hi Kris, when I first tried to use it, it failed as the script is set up to update layers and I needed to update a table in a feature service. If you publish your csv as a table then you can do the same. I had to change line 40 of Jake's script from arcpy.conversion.FeatureClassToFeatureClass to arcpy.conversion.TableToTable and lines 64 and 86 refer to fLyr = premiseLayer.layers[0] so I changed this to fLyr = premiseLayer.tables[0], which seemed to do the trick.

Also I changed the GIS object on line 18 to gis = GIS("Pro") as I didn't want to store my user credentials in the script so I found out that by using this your credentials can be read from ArcGIS Pro. You just need to make sure your login is saved automatically in Pro.

Once you've tested your script and it works you can save it as a python file and then add it to an ArcGIS tool box. Open the script in the geoprocessing window of Pro and the drop down next to run will allow you to schedule the tool to run regularly. My issue is I'm not sure how to run it when I'm not working and my pc is off. I may need to look into a virtual machine.

Like I said I'm a beginner when it comes to the python API but with a little tinkering was able to get mine to work. Hope you manage to get something working at your end too. Cheers

 

0 Kudos
KanchanaKarthikeyan
Esri Contributor

I wanted to use the Dynamic 1:1 join in a Collector Map to visualize the parent records based on the latest related table record that I submit. The view in Collector map would also help me pass the latest status to a survey using the Survey123 Custom URL Scheme. The purpose was purely just to visualize and pass the joined value from the related table to a Survey.

The hosted view that gets created as a result of Join Features Tool is not enabled for sync and cannot be made to do so from the Settings Interface in the item. It also does not create a view that is similar to a hosted view that we can create from hosted feature layers. I also noticed that it does not grab the service capabilities from the parent layer if it was published with syncEnabled = 'true'.

While editing the JSON is not best practice, I went ahead and syncEnabled the Dynamic Join View that I created, using Update Definition, and added that layer into the Collector map. That activated the Offline Map Settings in my web map settings and it worked from Collector.

JimmyKnowles
Occasional Contributor II

Kanchana, I have a need to this, so I was curious if you have experienced any negative effects from enabling sync on the dynamic join view? Does anyone know what negative repercussions could occur from doing this? Thanks.