ChristopherTStayte

Edit Operation Fails On Second Use

Discussion created by ChristopherTStayte on Feb 6, 2017
Latest reply on Feb 8, 2017 by ChrisStayte

I am trying to take the selection the use has and change a value in the field from 'null' to 1. This seems easy with inspector but I run it once and it works fine. I run it the second time and i get an edit operation has failed. I am unsure why this is happening.

public void Update(int status, Layer featureLayer, string editName)
{
QueuedTask.Run(async () => {
try
{
var basicfeaturelayer = _selectedLayer as BasicFeatureLayer;
var selection = basicfeaturelayer.GetSelection();
var oidset = selection.GetObjectIDs();


var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(true);
insp.Load(basicfeaturelayer, oidset);
insp[InpsectorFieldName] = 1;
await insp.ApplyAsync();

basicfeaturelayer.ClearSelection();
} catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}

});
}

Outcomes