Geoprocessing Widget help

2555
23
Jump to solution
10-03-2016 08:24 AM
Labels (1)
JamesCrandall
MVP Frequent Contributor

Geoprocessing Widget "hangs" if nothing is selected before hitting "Execute" button.

Sorry for cross-post, I'm not getting any response in the other forum https://community.esri.com/thread/183807-gp-widget-hangs

The current implementation is actually working just fine!  However, I am not sure where to look or if it's possible to make an adjustment in the GP widget itself to help alleviate this problem.  If the user doesn't select any features before hitting "Execute" on the widget, it seems to become unresponsive, however it does finally clear itself and returns to normal after a couple of minutes.

This behavior will confuse users who will be very click-happy and exclaim the application is broken.  I am hoping that there is a simple tweak I can apply to the widget itself to account for nothing being selected and perform a quick exit out of process.

This is the standard Geoprocessing widget that acquires a Feature Set (the selection) and uses that as an input parameter.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

James,

    here is the solution:

Geoprocessing\editors\SelectFeatureSetFromLayer.js (comment out lines 8 - 19 and add 20):

    getGPValue: function(){
      var def = new Deferred();

      this.spatialFilterByFeatures.getFeatureSet(true).then(lang.hitch(this, function(featureSet){
        def.resolve(featureSet);
      }), lang.hitch(this, function(err){
        if(err && err.type === SpatialFilterByFeatures.NONE_SELECTED_FEATURES_NOT_DRAW_SHAPES){
          // var layer = this.spatialFilterByFeatures.getSelectedLayer();
          // if(layer && layer.url){
          //   var query = new Query();
          //   query.where = '1=1';
          //   layer.queryFeatures(query).then(lang.hitch(this, function(response){
          //     def.resolve(response);
          //   }), lang.hitch(this, function(error){
          //     def.reject(error);
          //   }));
          // }else{
          //   def.reject(err);
          // }
          def.resolve(null);
        }else{
          def.reject(err);
        }
      }));

      return def;
    };‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

23 Replies
RobertScheitlin__GISP
MVP Emeritus

James,

   It should be easy enough to disable the execute button until a selection is made in the widget but I don't have a GP to test with.

0 Kudos
JamesCrandall
MVP Frequent Contributor

Does the GP service you need to test against have to accept that Feature Set parameter?  Or can it be just some basic GP service that doesn't do much of anything?

I'm asking because this particular GP service is actually behind our firewall since it's performing edits/inserts on a Feature Class in one of our SDE databases.  But if you just need an endpoint to set the widget to, can't you just enter anything?

Thanks a bunch!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

James,

   It would have to be a GP that takes a Feature Set as input. The GP widget builds the UI based on the GP service and it's parameters.

0 Kudos
JamesCrandall
MVP Frequent Contributor

Sending you a PM with a GP service url to test with.

Thanks a ton.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

James you can send it now.

0 Kudos
JamesCrandall
MVP Frequent Contributor

Sent!

The messenger tool is flakey so look for the second PM.  

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

James,

  It was even easier than I thought... Just open the config_Geoprocessing.json from your app and change the inputParams > required to true then when the execute button is clicked a message pops up saying "blank is Required" Where blank is the name of the input parameter.

JamesCrandall
MVP Frequent Contributor

I'll give it a go.

Super appreciative, Robert. Thanks a bunch!

0 Kudos
JamesCrandall
MVP Frequent Contributor

Here's one issue: if the user actually selects a service layer from the widget's drop-down list but does not make a selection in the map and hits "Execute", then it will become unresponsive.

0 Kudos