I am getting the hang of using Geoprocessing tools in ArcGIS Pro SDK. I am not sure how to use the sort tool in the data management toolbox, such as how to code the sort_fields for the script below to work.
var sort_fields = new List<Tuple<string, string>>
{
Tuple.Create(AggregateField,"ASCENDING"),
Tuple.Create("MUKEY","DESCENDING")
};
var para = Geoprocessing.MakeValueArray(intersectFC,intersectSortFC, sort_fields);
utility.GPRun("management.Sort", para);
public async void GPRun(string GPTool, IReadOnlyList<string> parameters)
{
var gp_result = await Geoprocessing.ExecuteToolAsync(GPTool, parameters);
if (gp_result.IsFailed)
{
MessageBox.Show("Error in running the Geoprocessing Tool: " + GPTool, "Geoprocessing Error");
}
}
Thanks for your help!
Solved! Go to Solution.
Hi,
Geoprocessing.MakeValueArray doesn't know how to manage your sorting fields.
Try to change List<Tuple<string, string>> parameter to simple string:
var sort_fields = $"{AggregateField} ASCENDING; MUKEY DESCENDING";
var para = Geoprocessing.MakeValueArray(intersectFC,intersectSortFC, sort_fields);
utility.GPRun("management.Sort", para);
Hi,
Geoprocessing.MakeValueArray doesn't know how to manage your sorting fields.
Try to change List<Tuple<string, string>> parameter to simple string:
var sort_fields = $"{AggregateField} ASCENDING; MUKEY DESCENDING";
var para = Geoprocessing.MakeValueArray(intersectFC,intersectSortFC, sort_fields);
utility.GPRun("management.Sort", para);