How to link a geoprocessing pick list (combobox) to field?

2961
8
05-02-2016 04:23 PM
DougBrowning
MVP Esteemed Contributor


This should easy but my attempts have failed and my searches come up empty.

I can build something like this below but the values in the drop down are static.  I want the drop to be dynamic with the values coming from a field.  As seen here I need job name to be linked to a geodatabase.  Ideally I would also like to be able to base Job Name on what was picked for Map Type.

Any publishing of the service seems to embed the values permanently so I would have to republish nightly to update list?

The query widget seems to do what i want but I see no way to link it to a geoprocessing tool.  Some setting in the geoprcesssing tool like "Link to selected features" would be nice.

Having a use select a polygon from a feature class then I use the attributes from that polygon for the tool would be ok but I only see a way to draw polygons for selection not click on one.

I got this to work in ArcMap using some funky validation code.  It was slow but worked.  Seems like this would be a simple click or checkbox in Web App Builder but I just am not seeing it.

Thanks.

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Doug,

  By no means what you are trying to do is simple. I don't use GPs at all because I can do it all through custom code and custom widgets. I just wanted you to know before you spend lots of time thinking that your missing something simple, you are not. I have seen threads where people can do many things through validation like you are in ArcMap but that validation does not carry over when you publish the GP service. Your best bet is to just jump into widget development as you can create a custom widget that will use the DrawTool to create a point graphic that you can use to fire a QueryTask to select a polygon on the map. The return of that QueryTask will give you the polygon feature and its attributes. You can use a QueryTask again to populate the Job Name based on a query string that is built using the criteria of the selected value in Map Type.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I meant it should be easy but i figured it was not.  I have found posts back to 2011 of people wanting this but it has not been added yet.

One post I found seems like maybe a way but the poster never posted the actual code.

"OK so the answer is yes, you can configure the Geoprocessing Widget (.xml file) to work with your published geoprocessing task and input/output parameters. Very nice."

Could I maybe link the inputs for the geoproceesing to the output of the query widget?

I have customized some of your flex widgets before without knowing flex but not sure I can start making custom widgets here yet.  This was for a proof of concept moving to a browser but not looking good.

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Doug,

  There is little you can do based on your desired workflow without jumping into custom development. There is nothing otb for this and GPs are still going to come up short.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I would be fine skipping all of the draw tool part.  Just a drop down used as input to the GP tool I already have is great.  The code should all be in the query widget. 

I have the web app builder up but when I try to import the app i started it bombs.  Says to check the log for more details but I have no idea where that log would be?

I can not even get to a place where i see code yet.  Any docs on how?

thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Doug,

  Have you downloaded the Web AppBuilder Developer Edition?

Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers

On that same page linked above is the guide getting started:

Get started—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers 

0 Kudos
DougBrowning
MVP Esteemed Contributor

I finally got it to import.  Did not know to leave the cmd window open. 

Code for the Query widget is 1,360 lines.  With next to 0 javascript experience I have a feeling this is not going to happen.

I find it strange this is not build in.  I could do this easily in domino back in the 90s.

Hopefully it will get added someday.

Thanks a lot

0 Kudos
DougBrowning
MVP Esteemed Contributor

Maybe someone has a hint on where to start in the code to find this?  I found param.choiceList in editorManger.js in the Geoprocessing widget which may be the lost of choices.  I can not find where it is populated though.  If I could do something like param.choiceList = results from a query that may work.

in

    }else if(editorName === 'Select'){

      o.gEditor = new Select({

        options: array.map(param.choiceList, function(choice) {

          return {

            label: choice,

            value: choice

          };

Thanks

0 Kudos
IfeomaCollins
New Contributor II

Hi Doug, 

I recommend creating an event handler on the widget.js page for the Job name drop down when the value of the map type drop down changes. You can then pass the values you need as an array dynamically to the job name drop down depending on what was chosen in the map type drop down using an if/then statement. 

0 Kudos