Select to view content in your preferred language

How to Implement Custom tool Validation for Geoprocessing Widget

6913
14
09-16-2015 10:11 AM
AlexisGreen
Emerging Contributor

I've added a geoprocessing service to the Geoprocessing widget in Web AppBuilder.  Within the GP tool that was authored in ArcGIS Desktop, I have some custom validation logic written using Python, which works fine when running the GP tool in ArcGIS Desktop, but which is ignored when publishing the tool as a GP service and running it via Web AppBuilder's Geoprocessing widget.  The UI for my tool consists of 2 drop-down menus to collect the 2 input parameters from the user.  The parameter validation needs to happen before tool execution, and I need the validation logic to update the values in the 2nd drop-down menu based on the value that the user chooses in the 1st drop-down menu.

It seems that a possible approach to implementing this type of special validation code would entail using the Developer Edition of Web AppBuilder to customize the "Settings UI".  Anyone have experience with this type of client-side parameter validation in Web AppBuilder who would be willing to share some tips with me?  Is this something that would be relatively easy to do, or does it require advanced JavaScript development or experience with the API?  Thanks for any feedback.

14 Replies
JianWang3
Deactivated User

The Geoprocessing widget in Web AppBuilder is a general purpose tool. It doesn't provide such method to set the validation rules for each parameter. Maybe it's a good idea to valid parameter in the client, but all information of Geoprocessing widget in setting page comes from the service definition where there is nothing about the validation rules for input parameters.

I think it's better to develop a custom widget to do the things you want if possible.

0 Kudos
AlexisGreen
Emerging Contributor

Thanks for your feedback. In planning a strategy, I was under the impression that modifying/extending the Out of Box Geoprocessing widget in the Web AppBuilder would be easier than starting "from scratch" writing a whole new custom widget, but perhaps not.  Anyone built a custom widget with parameter validation logic similar to what can be done in a Python script tool?  I'm leaning toward the JavaScript API for cross-platform support.  I would be very grateful for advice on how to get started doing this.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Every get anywhere on this?  I agree the code site in the query widget so no need to start over.

0 Kudos
RichardHughes2
Frequent Contributor

It is my understanding based on what I've seen, that only a Python Toolbox published as a GP Service will provide dynamically updating Choice Lists.  I don't know why a script tool would not also work.  Does Esri have any guidance on this.  Does a Python Toolbox run the  Custom Validation Code when it gets published as a GP Service?

JulioGaspar1
Occasional Contributor

Hi guys,

I have the same problem here.

0 Kudos
tigerwoulds
Frequent Contributor

Unfortunately, I can confirm that validation code does not carry over from a Python Toolbox to GP Server. I have a Python Toolbox (not a Script Tool) published as a GP Service to ArcGIS Enterprise 1081. The toolbox has validation code to update a parameter's drop down lists based on the user updating another parameter. This functionality does not carry over to the GP Widget in Web AppBuilder after publishing as a GP Service. 

JyotiRohodia
Occasional Contributor

I am running into the same a problem. Along with this, apparently even multivalue parameter in a script tool doesn't work as expected when published as a gp service.

Any guidance on custom widget would be greatly appreciated!

0 Kudos
RichardHughes2
Frequent Contributor

I have seen this working in a python toolbox. but I have not yet tested myself.  I am thinking that the extra python may have more control over the input drop down list.  This is just a hunch based on one other GP service I've seen that I believe had an updating pickList.  I've not found much documentation on this either.

0 Kudos
JyotiRohodia
Occasional Contributor

Hi Richard,

Thank you for your reply.

I tested the multi-value parameter in python toolbox (.pyt). Apparently both script tool and .pyt toolbox allows multivalue parameter.

But, when we publish these tools to Arc Server (10.6), they allow you to choose multiple inputs based on the data layers which were copied over along with the tool- so the inputs become STATIC. I would like to have the option to upload my own multiple layers while running the tool - more like DYNAMIC inputs. 

This behavior could be seen when you publish a basic Merge gp tool as well (this tool which is suppose to accept multiple inputs).

0 Kudos