Hi, good day
Esri and Esri Community
I´m trying to create a button that mass update data of a field in arcgis pro sdk (like the Field Calculator do).
I found many ways to solve it but I don’t know which is the fastest for mass update data; ¿anyone can help me to identify the best solution?
Solutions:
Actually I’m using Geoprocessing Tool (CalculateField_management).
Can you explain what do you mean by "mass update"? What is your data saved in?
I do not think you can use Search/Cursor to update data.
EditOperation is the recommended way to update data.
The fastest way is likely a direct database call but you are exposing yourself to breaking something if you are not 100% sure what you're doing.
Hi ViktorSafar
Thanks for answer.
Right now i'am trying to standardize addresses that are store in standalone table inside a filegeodatabase (testing.gdb).
For example, massive change the address (New York 10032 United States America) or (New Y 10032 United States) or (NYork 10032 United America) to standart adress (NY 10032 USA) for throusands of records (like 30.000 or more).
Here some code of my app when i clic the button "Normalizar".
List<string> listaConsultas = new List<string>();
private async void Button_Click(object sender, RoutedEventArgs e)
{
var mvp = MapView.Active.Map;
string NameTablaIngreso = this.MiComboBox1.Text.ToString();
string NameCampoDireccion = this.MiComboBox2.Text.ToString();
var tablaIngreso = mvp.GetStandaloneTablesAsFlattenedList().OfType<StandaloneTable>().Where(lyrd => lyrd.Name == NameTablaIngreso).FirstOrDefault();
listaConsultas.Add("!" + NameCampoDireccion + "!.replace(\"New York\", \"NY\")");
listaConsultas.Add("!" + NameCampoDireccion + "!.replace(\"New Y\", \"NY\")");
listaConsultas.Add("!" + NameCampoDireccion + "!.replace(\"N York\", \"NY\")");
var comotabla = tablaIngreso as StandaloneTable;
await QueuedTask.Run(() =>
{
for (int rdc = 0; rdc < listaConsultas.Count; rdc++)
{
var args = Geoprocessing.MakeValueArray(comotabla, NameCampoDireccion, listaConsultas[rdc], "PYTHON3");
var gp_result = Geoprocessing.ExecuteToolAsync("CalculateField_management", Geoprocessing.MakeValueArray(args.ToArray()));
comotabla.ClearSelection();
}
}
MessageBox.Show("End.");
}
Here my interface.