AnsweredAssumed Answered

create-feature-from-a-modified-inspector

Question asked by BOWDENJ_lvvwd_snwa on Apr 20, 2020
Latest reply on Apr 21, 2020 by BOWDENJ_lvvwd_snwa

https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Editing#create-feature-from-a-modified-inspector

I copied this code and ran it against a versioned feature class in enterprise sde (Oracle 12.1). It fails with "Edit operation failed." as the edit operation error message.  I'm trying to take the selected feature make a copy and update some attributes is this the best way? Should I try some other method?

 ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
var layer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers("WATERLINE").FirstOrDefault() as BasicFeatureLayer;
insp.Load(layer, 364323);
// modify attributes if necessary
// insp["Field1"] = newValue;
insp["STATUS"] = 9;
//Create new feature from an existing inspector (copying the feature)
var createOp = new ArcGIS.Desktop.Editing.EditOperation();
createOp.Name = "Create from insp";
createOp.Create(insp.MapMember, insp.ToDictionary(a => a.FieldName, a => a.CurrentValue));
createOp.Execute();
});

Outcomes