Select to view content in your preferred language

Geoprocessing.ExecuteToolAsync C# SYNTAX

3521
13
Jump to solution
04-19-2018 09:50 AM
MikeRatcliffe
Frequent Contributor

After reviewing available examples and references (only available in Python), I am unable to pass a successful Geoprocessing.MakeValueArray into the ExecuteToolAsync.  I am confident it is a C# #syntax issue, and need some help...

Example Code:

main_lyr.Select(qf, SelectionCombinationMethod.New);

var in_table = main_lyr;
var out_table = Path.Combine(Project.Current.DefaultGeodatabasePath, GVar.FtrLyr + " Results");
var statistics_fields = "FEET, Sum"; //[['FEET', 'SUM']]";
var case_field = "Diameter"; // "['Diameter']";

var args = Geoprocessing.MakeValueArray(in_table, out_table, statistics_fields, case_field);

var sp_ref = SpatialReferenceBuilder.CreateSpatialReference(102629); // NAD83 SP AL E FIPS 0101 Feet

var envi = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: sp_ref);

Geoprocessing.ExecuteToolAsync("Statistics_analysis", args, envi, null, null, GPExecuteToolFlags.Default);

0 Kudos
13 Replies
MikeRatcliffe
Frequent Contributor

Firstly, THAT worked! "FEET Sum"

Just to clarify, the syntax documented here in the arcpy environment:

Summary Statistics—Help | ArcGIS Desktop 

is

[["Shape_Area", "SUM"]]

Thank you.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Let’s communicate via email until we find a solution – if it is okay with you. Thanks.

nahmed@esri.com

0 Kudos
MikeRatcliffe
Frequent Contributor

Ok, Nobbir.  I'm satisfied with the solution syntax you provided in the previous post.  I can move forward with my Add-in code now.  Thanks.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Most probably you are right about: *****syntax of these variables is assumed to be the failure*****

I'll forward this to appropriate team. Meanwhile, I'll try to find a workaround. Thanks for your patience.

0 Kudos