Populate a widget dropdown list from a GP service input parameter Choice List

4212
1
Jump to solution
04-13-2016 08:51 AM
RebeccaWatson
Occasional Contributor

I have a Geoprocessing Service - GetRouteMeasure. I want to allow the user to select different layers to process in the service via a drop down list on my widget. The drop down list needs to be populated by the Choice List for the input parameter Input_Discipline as shown below e.g. Pipelines, Roads etc. Is there a way to do this?

Thank you

0 Kudos
1 Solution

Accepted Solutions
RebeccaWatson
Occasional Contributor

I still haven't completely got there, but for anyone interested to access the ChoiceList I have put the following in the initialise function followed by the result handler below.

var taskinfoRequest:JSONTask = new JSONTask();
var urlVars:URLVariables = new URLVariables();
urlVars.f = "json";
taskinfoRequest.url = gp.url;
taskinfoRequest.execute(urlVars, new AsyncResponder(taskinfoRequest_resultHandler, taskinfoRequest_faultHandler));


private function taskinfoRequest_resultHandler(taskInfo:Object, token:Object=null):void
{
var List:String = JSON.stringify(taskInfo.parameter[2].choiceList);
Alert.show(List);
}

View solution in original post

0 Kudos
1 Reply
RebeccaWatson
Occasional Contributor

I still haven't completely got there, but for anyone interested to access the ChoiceList I have put the following in the initialise function followed by the result handler below.

var taskinfoRequest:JSONTask = new JSONTask();
var urlVars:URLVariables = new URLVariables();
urlVars.f = "json";
taskinfoRequest.url = gp.url;
taskinfoRequest.execute(urlVars, new AsyncResponder(taskinfoRequest_resultHandler, taskinfoRequest_faultHandler));


private function taskinfoRequest_resultHandler(taskInfo:Object, token:Object=null):void
{
var List:String = JSON.stringify(taskInfo.parameter[2].choiceList);
Alert.show(List);
}
0 Kudos