GP widget does not accept Multivalue parameter, but job thru REST does...why? syntax?

1787
2
08-30-2012 10:13 AM
C_EHoward
Occasional Contributor III
I have a GP widget that allows a user to select data layers to be clipped and zipped to a particular extent, in my case, by county. I can successfully have this GP service run if i submit the job through the REST endpoint. I have to submit my layers with the following syntax for my 'layers_to_clip' parameter: ['Layer1','Layer2']. The parameter that selects the county, based on an input list, passes fine.

When I try to run the GP service in Flex through the GP widget, it returns an error. My config file has multivalue:string (something I found the hard way) with a choicelist of layers. When I select more than one layer in my Flex widget interface, I get the error "Problem esriJobFailed Failed." message.

The messages XML in the failed job folder has the Layers_to_Clip input parameter as follows: "Layers to Clip: Dataset 'Layer1';'Layer2' does not exist or is not supported". which leads me to believe that the Flex GP widget does not use the correct syntax to pass a multivalue string list. Can anyone confirm this? How can I get around this?


FWIW, I can get the widget to 'work' if I only select one layer from  my list. I say 'work' in quotes since I still cannot see/save my output ZIP file. But I will tackle that issue when I can successfully select more than one layer to download.

Charlene
Tags (2)
0 Kudos
2 Replies
NeoGeo
by
Occasional Contributor III
Here is a working example using a multivalue parameter with Flex and AGS 10.0 (just the applicable code shown).  Layoutelements is the multivalue parameter.  I have not been able to get it to function under 10.1 because as far as I can tell the only way to create a service now is to run it from the Desktop, but the Desktop won't allow entry of a multivalue parameter (at least it won't for me because it just grays out the add value button, so if you figure out a workaround for that, let me know.)

Here is the Flex portion:

private var printUtil:PrintUtil;
printUtil =  new PrintUtil(map);

printUtil.LayoutElements = [title,author,locateCoordinateString];


var params:Object = printUtil.getPrintParameters();

exportMapGP.submitJob(params);


 <fx:Declarations>
  <esri:Geoprocessor id="exportMapGP" url="{gpServiceURL}" />
 </fx:Declarations>



Here is the Python portion. 
    #Create a dictionary with the element name and element value
    elemSettings = params.get_layoutelements()
    i = 0
    dictionary = dict({})
    for subnode in elementNode:
        elemName = subnode.attrib["name"] 
        elemValue = elemSettings.getRow(i)
        elemValue = elemValue[1:]
        elemValue = elemValue[:-1]
        elemValue = elemValue.replace("*","\n")
        i = i + 1
        logging.info(elemName + ": " + elemValue)
        if elemValue:
            dictionary[elemName] = elemValue
            logging.info(elemName + ": " + elemValue)
0 Kudos
C_EHoward
Occasional Contributor III
Thanks for the code. I got it to work in 10.....have not attempted at 10.1 yet. I had to move onto other things, but I will be revisiting this, so they better make sure all available parameters in 10 are there in 10.1. I am not holding my breath however since it usually takes users trying to do their work to expose shortcomings
0 Kudos