Hi,
I'm trying to get the columns out, but it doesn't do anything at all, I tried it gradually, I tried them all at once but without any success. Can anyone advise me?
FeatureLayer flRamyPresahu = mapView.Map.FindLayers(ramyPresahu).FirstOrDefault() as FeatureLayer;
FeatureClass fcRamyPresahu = flRamyPresahu.GetTable() as FeatureClass;
var minX = "ExtentMinX";
var minY = "ExtentMinY";
var maxX = "ExtentMaxX";
var maxY = "ExtentMaxY";
object[] sloupce = {maxX,maxY,minX,minY};
object[] seznamSloupcu = { fcRamyPresahu, sloupce };
await StartATask("management.DeleteField", seznamSloupcu);
If your FeatureClass is in a geodatabase (file, mobile, enterprise, or memory), you can use this snippet to remove a field
https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#removing-fields-from-a-table
Otherwise, you can use this code to use the GeoProcessing tool to remove a field.
var args = Geoprocessing.MakeValueArray(fcRamyPresahu, sloupce);
IGPResult result = await Geoprocessing.ExecuteToolAsync("management.DeleteField", args, null, null, null, GPExecuteToolFlags.None); //the last parameter does not add the result to the map
Read this page on more information about using GeoProcessing tools
It has m processed in its
StartATask
But thank you for your time.
What does your StartATask function look like?
public static async Task<bool> StartATask(string funcArc, object[] parame)
{
var parameters = Geoprocessing.MakeValueArray(parame);
await Geoprocessing.ExecuteToolAsync(funcArc, parameters);
return true;
}
Instead of just returning true, why not get a report on why it failed?
public static async Task<bool> StartATask(string funcArc, object[] parame)
{
var parameters = Geoprocessing.MakeValueArray(parame);
var result = await Geoprocessing.ExecuteToolAsync(funcArc, parameters);
if (result.IsFailed)
{
Geoprocessing.ShowMessageBox(result.Messages, "Content Header", GPMessageBoxStyle.Error);
}
return !result.IsFailed;
}