Web Appbuilder GP Service results

2195
4
02-16-2016 02:12 PM
AllenScully
Occasional Contributor II

We have a fairly simple GP Service built, and are building the widget in WAB.  The tool is a custom python script (not from Model Builder).  Basically you click on the map, and the script runs and returns a calculated value (water pressure, in this case).  

The GP Service runs correctly, and in ArcMap the pop-up displays the results, which are just a constructed text string configured in an arcpy.AddMessage... statement.  

In WAB, the tool appears to be executing correctly, but no results are returned.  This is because the Output section has no configuration.  The output page is blank when the tool is finished running.  All I need to do is hook up that output tab in the GP Widget in WAB to the arcpy.AddMessage value in my script.

Looking at the config_Geoprocessing.json script, I can see the "outputParams" are empty, so I'm just looking for some tips on what needs to go in there to finish this up.

Thanks -

Allen

0 Kudos
4 Replies
JohnGrogan
New Contributor II

Can you not use a derived Output parameter for passing the results back?  Works fine for me (Geoprocessing tool from Python script, Web App Builder) using the Geoprocessing Widget to run the GP service (not a custom widget).

AllenScully
Occasional Contributor II

Thanks John -

Yes, I think it needs to be a derived output parameter.  But as a relative newbie to scripting Geoprocessing tools, I'm not totally sure how to get the AddMessage content into that parameter.

0 Kudos
XanderBakker
Esri Esteemed Contributor

The arcpy.AddMessage() will have no effect on the GP widget in WAB. You can collect the strings and concatenate them and show them at the end using the SetParameter—Help | ArcGIS for Desktop

AllenScully
Occasional Contributor II

Thanks -

Took some trial and error but I got it going.  Essentially created variables in the python script that represented the same string values I had in the AddMessage tools.  Then using SetParameter I referred to those variables, and set 2 corresponding derived output parameters in the script (in ArcMap - properties for the script), then published GP Service.

The desired results now show up in the WAB Geoprocessing widget, with essentially no configuration in WAB other than plugging the GP Service into it.

Appreciate the help.

Allen

0 Kudos