FeatureLayer.applyEdits not working sometimes...

2854
10
09-07-2016 09:32 PM
ShaikhRizuan
New Contributor III

Hi,

I am having an application developed in WAB, Where we have customized an identify widget to push the data to feature service after identifying the layer on map. There will be multiple users who will be updating the feature service.  I am using FeatureLayer.applyEdits() method to update/insert /delete the feature.

Sometimes we could able to update/insert /delete the features in features service from application and sometimes it shows processing image in application for long time and there is no error logged in console.

We are having data in SQL server DB and ArcGIS 10.3. The features classes in DB are not versioned.

Kindly help me to get this solution.

Thanks,

Shaikh Rizuan

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus

Shaikh,

   If there are no errors in the browsers web console then have you checked your ArcGIS Server logs for any errors?

0 Kudos
ShaikhRizuan
New Contributor III

Robert,

when i checked in the logs, there were no errors found. PFB image for the same

Server Log

Please guide me to resolve this issue.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Shaikh,

   If there are no error then I can not help.

0 Kudos
ShaikhRizuan
New Contributor III

Hi Robert,

When i am trying to replicate the same attributes to the newGEometry, it is coming to "Edit Complete" Event only when there is any wrong attribute value. Like if i didn't include OBJECTID field to the array, it will go to "EditComplete" event. When i include OBJECTID, it will update the feature in background but not going to "EditComplete" event.

Below is the code

attr["APPLICATION_STATUS"] = existingFeature.attributes["APPLICATION_STATUS"];

...

....
attr["GIS_SITE_ID"] = existingFeature.attributes["GIS_SITE_ID"];
newUGraphics.setAttributes(attr);
newUFeatureLayer.applyEdits(null,[newUGraphics],null);

0 Kudos
thejuskambi
Occasional Contributor III

Hello Shaikh,

The information provided by you is insufficient. You are just sharing a code where you are calling applyEdits. We are not sure how your edit-complete event is setup. Also are you listening for error event? Is there any error there or in the console. It would be really helpful if you could setup as jsfiddler, where we can see the behaviour.

Thanks,

Thejus

0 Kudos
by Anonymous User
Not applicable

Hello,

For feature service use for edit or modification need to have versioned layers..

What is a feature service?—Documentation | ArcGIS for Server 

0 Kudos
ShaikhRizuan
New Contributor III

Hi Avinash,

we are having many ESRI Online feature services, which is open to the world. Any one can edit the features and those feature services are not versioned. PFB some links

Layer: Areas (ID: 9) 

https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/8
https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/6   

0 Kudos
by Anonymous User
Not applicable

Hello,

I have tried in ArcGIS online and able to edit / modify feature without any error.

ShaikhRizuan
New Contributor III

Hi,

Yes, i am also able to update the feature without any error, But after update of feature, it is not coming to "EditComplete" event for this service:Layer: Areas (ID: 9) . So, how do i know whether the feature has been updated or not ???

 I am selecting the feature by drawing graphics on the map load and then draw a graphics from draw widget tool and update the geometry with the graphics made by draw widget:

var newUFeatureLayer = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/9" );
newUFeatureLayer.on("edits-complete", function(evt) {
if(evt.adds.length >0 && evt.adds[0].success == true)
{

}

else if(evt.updates.length >0 && evt.updates[0].success == true)
{

}

});

var newUGraphics = existingFeature.setGeometry(this._graphicsLayer.graphics[0].geometry);

newUFeatureLayer.applyEdits(null,[newUGraphics],null);

It is working fine, i.e. coming to "edit-complete" event when i am creating a new feature and then deleting the old one

0 Kudos