Simple question, I hope:
What kind of "override" string expression is expected in this EditOperation.TransferAttributes overload method? Does anyone have an example or know of relevant documentation?
Hello,
Here is a sample of the expression that can be used to map field values between two features or rows with the EditOperation.TransferAttributes function.
return {"ADDRESS" : $sourceFeature['ADDRESS'],"IMAGE" : $sourceFeature['IMAGE'],"PRECINCT" : $sourceFeature['PRECINCT'],"WEBSITE" : $sourceFeature['WEBSITE'],"ZIP" : $sourceFeature['ZIP']}
Here's an example of a simple button that will transfer attributes from a source feature (oid 1) in the Police Stations layer to a destination feature (oid 2) in the same layer
protected override void OnClick() { var layer = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(l => l.Name == "Police Stations"); if (layer == null) return; string expression = "return {\r\n " + "\"ADDRESS\" : $sourceFeature['ADDRESS'],\r\n " + "\"IMAGE\" : $sourceFeature['IMAGE'],\r\n + " + "\"PRECINCT\" : $sourceFeature['PRECINCT'],\r\n " + "\"WEBSITE\" : $sourceFeature['WEBSITE'],\r\n " + "\"ZIP\" : $sourceFeature['ZIP']\r\n " + "}"; QueuedTask.Run(() => { var op = new EditOperation(); op.Name = "Transfer atts"; op.TransferAttributes(layer, 1, layer, 2, expression); var success = op.Execute(); }); }
I'll make sure the documentation for the function is updated. Let me know if you have any additional questions.
Narelle
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.