Select to view content in your preferred language

Geoprocessing Tasks - Getting input parameter choices

1821
7
Jump to solution
11-08-2012 07:53 AM
MarkCollins
Frequent Contributor
Hello,

I am trying to figure out how to programmatically get the list of available input parameters for a geoprocessing task and the choice list for the parameters. My end goal is to populate a combo box with the available choices. Here is an example of one of the input params in my service:

Parameter: Day_or_Night_incident
Data Type: GPString
Display Name Day or Night incident
Direction: esriGPParameterDirectionInput
Default Value: Day
Parameter Type: esriGPParameterTypeRequired
Category:
Choice List: [ Day, Night ]

I have tried to get them with calls to GetInputAsync like so:
geoprocessorTask.GetInputAsync("1", "Day_or_Night_incident");

This does not work, i just get an error message returned of: Error = {"Invalid or missing input parameters."}

What is the proper way to get a list of input params and their choices for a GP service? I couldn't find any SDK samples that do this.

My GP task works fine in ArcMap and when called from the SDK w/ my parameters statically defined so I know there is not an issue with my service.

Thanks,
Mark
0 Kudos
1 Solution

Accepted Solutions
deleted-user-ATjHIWsdQYmT
Deactivated User
At the 3.0 API there is a GetServiceInfoAsync() method.  It'll return GPServiceInfo.  GPServiceInfo has a parameters[] method... Give that a try.

http://resources.arcgis.com/en/help/silverlight-api/apiref/api_start.htm?ESRI.ArcGIS.Client~ESRI.Arc...

View solution in original post

0 Kudos
7 Replies
deleted-user-ATjHIWsdQYmT
Deactivated User
At the 3.0 API there is a GetServiceInfoAsync() method.  It'll return GPServiceInfo.  GPServiceInfo has a parameters[] method... Give that a try.

http://resources.arcgis.com/en/help/silverlight-api/apiref/api_start.htm?ESRI.ArcGIS.Client~ESRI.Arc...
0 Kudos
MarkCollins
Frequent Contributor
Andrew,

This appears to be exactly what I was looking for, thank you! Do you have happen to know if there is something similar in WPF SDK as well? I'm not finding a GetServiceInfo call on that API.

Thanks,
Mark
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
Andrew,

This appears to be exactly what I was looking for, thank you! Do you have happen to know if there is something similar in WPF SDK as well? I'm not finding a GetServiceInfo call on that API.

Thanks,
Mark


I don't use WPF, but it appears there are two methods, one async and one synchronous.

http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.G...

http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.G...
0 Kudos
MarkCollins
Frequent Contributor
Andrew,

Thanks for pointing me in the right direction. Turns out my test project still had a reference to the old SDK, and the problem actually existed between the keyboard and the chair 😄  I updated my SDK reference it and was able to find the methods in question.

-Mark
0 Kudos
danielchaboya
Regular Contributor
I think I'm using the same toolbox (Emergency Response Geoprocessing Tools) as Mark.  I've tried using some of the Geoprocessing tasks from the API samples but have yet to succsesfully populate a comb box with a list of parameter values.

For one of the examples the following is used to call the parameters:
 List<GPParameter> parameters = new List<GPParameter>();
        parameters.Add(new GPFeatureRecordSetLayer("Input_Features", mapPoint));
        parameters.Add(new GPString("Height", HeightTextBox.Text));
        parameters.Add(new GPLinearUnit("Distance", esriUnits.esriMiles, Convert.ToDouble(MilesTextBox.Text)));


Aside from making sure the xaml code names match those in the C# code, what else needs to happen to get a list of parameters in a combo box?
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
Check this:
http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli...

It will return GPServiceInfo() which you can parse and get the input parameters.  Then take those parameters and put them into a list, and use that to populate your combo box.
0 Kudos
danielchaboya
Regular Contributor
Thanks for the response Andrew.  Your solution kind of makes sense to me, but I'm not a programmer so it'd be difficult for me to develop that bit of code (either way i'll give it a shot).  Up untill now i've hacked my way, with the help of the samples, in to developing a decent web app.  The Emergency Response tool has proven to be a formidable defensemen ( maybe more like a Ray Lewis) and has stopped me from moving any further on this project :cool:

Cheers
0 Kudos