Select to view content in your preferred language

EditTask stops working

1207
8
06-14-2010 02:31 PM
deleted-user-pYdfRjvSAbTJ
Deactivated User
hello,
I have an EditTask that works over a FeatureService (an mxd with a data source from a SQL Server Express direct connect).
when I repeatedly call an ApplyEdits the EditTask stops working: it doesn't fail, but in the completed event, even if the Success result is true, the AddResult property has zero items, telling that no new item were added.
Not only: in the first few times the FeatureService responds very quickly and fine, then it starts to respond slowly and no modification works via EditTask until I restart it.
Any ideas? some lock on the data that prevents further edits?

Thanks in advance.
0 Kudos
8 Replies
dotMorten_esri
Esri Notable Contributor
It was a mistake that EditTask was public in the beta. This will not be the case in the next drop.
Instead you should be editing features through the FeatureLayer itself by modifying its Graphics collection directly.

On a side note, the behavior you describe is often caused by adding more and more eventhandlers to an object. Ie. you forget to unhook it again, and you keep adding the same eventhandler over and over again every time you execute it.
0 Kudos
deleted-user-pYdfRjvSAbTJ
Deactivated User
I found the solution to this problem using Fiddler and the ArcGIS Server REST web interface.
The problem was that I tried to add a feature with some wrong attribute values: a text attribute with a value longer than the field length.
The EditTask works fine, even if this is a public Beta (please, next time tell us not to use something if you think so...), but I think you should improve the feedback from the operation submitted: maybe a message reporting the problem would be appricieted.
0 Kudos
dotMorten_esri
Esri Notable Contributor
"please, next time tell us not to use something if you think so...""
I just did 🙂

"maybe a message reporting the problem would be appricieted."
We do report the message that the REST server sends back.

If you edit this through the featurelayer, you will automatically get this field validation on the client as well.
0 Kudos
deleted-user-pYdfRjvSAbTJ
Deactivated User
When I said to tell us not to use something I didn't mean in the forum after a post about an issue, but directly on the API main web page. You told me that introducing EditTask in the public Beta was an error, but if I don't have any evidence in the reference that I shouldn't use it, I consider it as a plain usable tool.

In general using a FeatureLayer is not alway possible: not all FeatureLayers are built on point featureclasses, with lines and polygons loading a FeatureLayer couldn't be an option because of performances.
0 Kudos
dotMorten_esri
Esri Notable Contributor
You don't have to add the featurelayer to the map to edit it, so it won't be a performance issue.
Sorry about the inconvenience. But that's partly what betas are for.
0 Kudos
egismazeika
Emerging Contributor
I'm using QueryTask to get features from FeatureServer service. How can I edit and save my edits since EditTask isn't available anymore?
0 Kudos
dotMorten_esri
Esri Notable Contributor
You should use FeatureLayer to do this. This is simlar to the other Client API's
0 Kudos
egismazeika
Emerging Contributor
You should use FeatureLayer to do this. This is simlar to the other Client API's


Morten, can you clarify this to me in more detail as I don't use any other Client API. I've created my internal FeatureLayer and try to "query" it:

edittingLayer.UpdateFailed += new EventHandler<TaskFailedEventArgs>(OnTask_Failed);
edittingLayer.UpdateCompleted += new EventHandler(edittingLayer_UpdateCompleted);
edittingLayer.Initialize();
...
edittingLayer.Where = "1=1";
edittingLayer.Update();

Object reference not set to an instance of an object.
  StackTrace:
       at ESRI.ArcGIS.Client.FeatureLayer.update()
       at ESRI.ArcGIS.Client.FeatureLayer.Update()

What is the right way to query features for editting?
0 Kudos