Enhanced Search Widget Version 2.23.1 - 11/22/22

536940
2821
07-14-2014 03:57 PM
Labels (1)

Enhanced Search Widget Version 2.23.1 - 11/22/22

Live Preview Site

Web AppBuilder for ArcGIS | Help - Enhanced Search widget

 

List of the latest enhancements and changes:

  1. Fixed issue with Spatial Relationship settings

Older enhancements or changes

Check the "Older enhancements or changes.txt" in the download for a complete list.

 

Older Versions

Last 2.21 version

Last 2.17 version

Last 2.13 version

Last 2.12 version

Last 2.11 version

Last 2.9 version

Last 2.7 version

Last 2.6 version

Last 2.5 version

Labels (1)
Attachments
Comments

The next release will resolve this minor ascetic thing (not minor in the amount work this required though ).

This is great Robert. Just tested it and is working great!! Thank You for the great work.


Hi Robert, I'm trying to move the folder eSearch to another path into the folder widgets (uri:"widgets/myWidgets/eSearch/Widget"), but I got problem with the file './List'. It file don't load because the uri is wrong (widgets/eSearch/List).
Anothers widgets working fine. Could you please help me with It?

Note: WAB version 2.2


eSearch version 2.2.1


Thanks in advance.

Alexander,

   Unfortunately not. There are going to be many more hard coded path like that in my widget. It was never intended to be renamed.

Hi Robert, On initial testing I thought the new version of the widget worked great. It worked when I deleted all the pre-configured layers that came with the widget except one.  However when I add my own layer and delete all the pre-configured layers, it gives me a blank dropdown as shown in the picture when I click the launch button on Webappbuilder IDE. When I click on the eSearch widget inside the IDE, it sometimes works and shows results correctly as shown in screenshot and sometimes does not work and looks like when you click the launch button. When you click the launch button and click clear fields button, you see results like shown in the screenshot. Also I have attached the screenshot of the widget configuration screen.I thought my webappbuilder installation or eSearch widget installation got corrupted but I have been able to reproduce the issue when I downloaded a fresh installation of the webappbuilder and the eSearch widget. I am using the latest version of the webappbuilder.Configure Screen Inside WebAppbuilder IDEWidget Working from inside Webappbuilder IDEWidget showing Issues when you click launch buttonWidget When You Click Clear Fields

Anish,

   This seems to be a timing issue. In the Widget.js replace your _initLayerSelect with this one:

_initLayerSelect: function () {
        this.serviceFailureNames = [];
        if(!this.currentFeatures){
          this.currentFeatures = [];
        }
        var options = [];
        var spatialOptions = [];
        var attribOptions = [];
        var len = this.config.layers.length;
        for (var i = 0; i < len; i++) {
          var option = {
            value: i,
            label: this.config.layers[i].name
          };
          options.push(option);
          if (this.config.layers[i].spatialsearchlayer) {
            spatialOptions.push(option);
          }
          if(this.config.layers[i].expressions.expression.length > 0){
            attribOptions.push(option);
          }
        }
        //select the first layer in the lists
        if (options.length > 0) {
          options[0].selected = true;
        }
        if (spatialOptions.length > 0) {
          spatialOptions[0].selected = true;
        }
        if (attribOptions.length > 0) {
          attribOptions[0].selected = true;
        }else{
          html.setStyle(this.addSqlTextDiv, 'display', 'none');
        }

        if (len > 0) {
          this.paramsDijit = new Parameters({
            nls: this.nls,
            layerUniqueCache: this.layerUniqueCache,
            disableuvcache: this.config.disableuvcache,
            selectFilterType: this.config.selectfilter
          });
          this.paramsDijit.placeAt(this.parametersDiv);
          this.paramsDijit.startup();
          this.paramsDijit.on('enter-pressed', lang.hitch(this, function () {
            this.search(null, this.AttributeLayerIndex, this.expressIndex);
          }));
          this.shelter.show();

          var defs = array.map(this.config.layers, lang.hitch(this, function (layerConfig) {
            return this._getLayerInfoWithRelationships(layerConfig.url);
          }));

          all(defs).then(lang.hitch(this, function (results) {
            this.shelter.hide();
            array.forEach(results, lang.hitch(this, function (result, j) {
              if(result.state === 'success'){
                var layerInfo = result.value;
                //console.info(layerInfo);
                var layerConfig = this.config.layers[j];

                if (layerInfo.objectIdField) {
                  layerConfig.objectIdField = layerInfo.objectIdField;
                } else {
                  var fields = layerInfo.fields;
                  var oidFieldInfos = array.filter(fields, lang.hitch(this, function (fieldInfo) {
                    return fieldInfo.type === 'esriFieldTypeOID';
                  }));
                  if (oidFieldInfos.length > 0) {
                    var oidFieldInfo = oidFieldInfos[0];
                    layerConfig.objectIdField = oidFieldInfo.name;
                  }
                }
                layerConfig.existObjectId = array.some(layerConfig.fields.field, lang.hitch(this, function (element) {
                  return element.name === layerConfig.objectIdField;
                }));
                layerConfig.typeIdField = layerInfo.typeIdField;
                //ImageServiceLayer doesn't have drawingInfo
                if (!layerInfo.drawingInfo) {
                  layerInfo.drawingInfo = {};
                }
                layerInfo.name = this.nls.search + ' ' + this.nls.results + ': ' + layerConfig.name;
                layerInfo._titleForLegend = layerInfo.name;
                layerInfo.minScale = 0;
                layerInfo.maxScale = 0;
                layerInfo.effectiveMinScale = 0;
                layerInfo.effectiveMaxScale = 0;
                layerInfo.defaultVisibility = true;
                this.resultLayers.push(layerInfo);
              }else{
                //remove this layer from the options list
                var oIndex = -1;
                array.some(options, lang.hitch(this, function(option,o){
                  if(option.label === this.config.layers[j].name){
                    oIndex = o;
                    return true;
                  }
                  return false;
                }));
                options.splice(oIndex, 1);
                if (this.config.layers[j].spatialsearchlayer) {
                  spatialOptions.splice(spatialOptions.indexOf(this.config.layers[j].spatialsearchlayer), 1);
                }
                this.serviceFailureNames.push(this.config.layers[j].name);
                this.resultLayers.push({});
              }
            }));
            setTimeout(lang.hitch(this, function(){
              if(options.length === 1){
                this.labelLayerGraphical.innerHTML = options[0].label;
                html.setStyle(dojoQuery(".esearch-select-graphic")[0], 'display', 'none');
                html.removeClass(this.labelLayerGraphical, 'hidden');
              }else{
                this.selectLayerGraphical.addOption(options);
              }
              if(attribOptions.length === 1){
                this.labelLayerAttribute.innerHTML = attribOptions[0].label;
                html.setStyle(dojoQuery(".esearch-select-attrib")[0], 'display', 'none');
                html.removeClass(this.labelLayerAttribute, 'hidden');
              }else{
                this.selectLayerAttribute.addOption(attribOptions);
              }
              if(spatialOptions.length === 1){
                this.labelLayerSpatial.innerHTML = spatialOptions[0].label;
                html.setStyle(dojoQuery(".select-layer-spatial")[0], 'display', 'none');
                html.removeClass(this.labelLayerSpatial, 'hidden');
              }else{
                this.selectLayerSpatial.addOption(spatialOptions);
              }
            }), 100);

            if(spatialOptions.length > 0){
              this.spatialLayerIndex = spatialOptions[0].value;
            }

            //now check if there is a url search to do
            var myObject = this.getUrlParams();
            if (myObject.esearch) {
              if(myObject.esearch === "last48"){
                var today = new Date();
                var priorDate = new Date(today.getTime() - (((24 * 60 * 60 * 1000) - 1000) * 2));
                var priorDateStr = this._formatDate(priorDate.getTime(), 'yyyy/MM/dd');
                myObject.esearch = priorDateStr + "~" + this._formatDate(new Date().getTime(), 'yyyy/MM/dd');
              }
              if(myObject.esearch === "thismonth"){
                var today = new Date();
                today.setDate(1);
                var thisMonthStr = this._formatDate(today.getTime(), 'yyyy/MM/dd');
                myObject.esearch = thisMonthStr + "~" + this._formatDate(new Date().getTime(), 'yyyy/MM/dd');
              }
              if(myObject.esearch === "thisyear"){
                var today = new Date();
                today.setMonth(0,1);
                var thisMonthStr = this._formatDate(today.getTime(), 'yyyy/MM/dd');
                myObject.esearch = thisMonthStr + "~" + this._formatDate(new Date().getTime(), 'yyyy/MM/dd');
              }
              if(this.config.layers[myObject.slayer].expressions.expression.length > 0){
                var valuesObj1 = lang.clone(this.config.layers[myObject.slayer].expressions.expression[myObject.exprnum || 0].values.value);
                var values = myObject.esearch.split("|");
                array.forEach(values, lang.hitch(this, function(val, index){
                  if (val.indexOf('~') > -1){
                    var ranges = val.split("~");
                    valuesObj1[index].valueObj.value1 = ranges[0];
                    valuesObj1[index].valueObj.value2 = ranges[1];
                  }else{
                    valuesObj1[index].valueObj.value = val;
                  }
                }));
                html.empty(this.textsearchlabel);
                if(this.config.layers[myObject.slayer].expressions.expression[myObject.exprnum || 0].textsearchlabel !== ""){
                  html.place(html.toDom(this.config.layers[myObject.slayer].expressions.expression[myObject.exprnum || 0].textsearchlabel), this.textsearchlabel);
                  html.style(this.textsearchlabel, 'display', 'block');
                }else{
                  html.style(this.textsearchlabel, 'display', 'none');
                }
                this.paramsDijit.build(valuesObj1, this.resultLayers[myObject.slayer], this.config.layers[myObject.slayer].url,
                                     this.config.layers[myObject.slayer].definitionexpression);
                on.once(this.paramsDijit, 'param-ready', lang.hitch(this, function () {
                  this._queryFromURL(myObject.esearch, myObject.slayer, myObject.exprnum || 0, myObject.close || false, attribOptions.length);
                }));
              }
            } else {
              //init the first available attrib layers paramsDijit
              if(attribOptions.length > 0){
                var aIndex = attribOptions[0].value;
                this.AttributeLayerIndex = aIndex;
                this._initSelectedLayerExpressions();
                if(this.config.layers[aIndex].expressions.expression.length > 0){
                  var valuesObj = lang.clone(this.config.layers[aIndex].expressions.expression[0].values.value);
                  html.empty(this.textsearchlabel);
                  if(this.config.layers[aIndex].expressions.expression[0].textsearchlabel !== ""){
                    html.place(html.toDom(this.config.layers[aIndex].expressions.expression[0].textsearchlabel), this.textsearchlabel);
                    html.style(this.textsearchlabel, 'display', 'block');
                  }else{
                    html.style(this.textsearchlabel, 'display', 'none');
                  }
                  this.paramsDijit.build(valuesObj, this.resultLayers[aIndex], this.config.layers[aIndex].url,
                                       this.config.layers[aIndex].definitionexpression);
                  on.once(this.paramsDijit, 'param-ready', lang.hitch(this, function () {
                    this.paramsDijit.setFocusOnFirstParam();
                  }));
                }
                //determine if this layer has any sum field(s)
                this._getSumFields(aIndex);
                if(this.sumFields.length > 0){
                  html.addClass(this.list.domNode, 'sum');
                  html.setStyle(this.divSum, 'display', '');
                }else{
                  html.removeClass(this.list.domNode, 'sum');
                  html.setStyle(this.divSum, 'display', 'none');
                }
              }
            }

            if(this.serviceFailureNames.length > 0){
              console.info("service failed", this.serviceFailureNames);
              new Message({
                titleLabel: this.nls.mapServiceFailureTitle,
                message: this.nls.mapServicefailureMsg + this.serviceFailureNames.join(", ") + this.nls.mapServicefailureMsg2
              });
            }
          }), lang.hitch(this, function (err) {
            this.shelter.hide();
            if(options.length === 1){
              this.labelLayerGraphical.innerHTML = options[0].label;
              html.setStyle(dojoQuery(".esearch-select-graphic")[0], 'display', 'none');
              html.removeClass(this.labelLayerGraphical, 'hidden');
            }else{
              this.selectLayerGraphical.addOption(options);
            }
            if(attribOptions.length === 1){
              this.labelLayerAttribute.innerHTML = attribOptions[0].label;
              html.setStyle(dojoQuery(".esearch-select-attrib")[0], 'display', 'none');
              html.removeClass(this.labelLayerAttribute, 'hidden');
            }else{
              this.selectLayerAttribute.addOption(attribOptions);
            }
            if(spatialOptions.length === 1){
              this.labelLayerSpatial.innerHTML = spatialOptions[0].label;
              html.setStyle(dojoQuery(".select-layer-spatial")[0], 'display', 'none');
              html.removeClass(this.labelLayerSpatial, 'hidden');
            }else{
              this.selectLayerSpatial.addOption(spatialOptions);
            }
            console.error(err);
            for (var j = 0; j < this.config.layers.length; j++) {
              var layer = new GraphicsLayer();
              this.resultLayers.push(layer);
            }
          }));
        }
        if(options.length === 1){
          this.own(on(this.selectLayerGraphical, "change", lang.hitch(this, this.onGraphicalLayerChange)));
        }
        if(attribOptions.length === 1){
          this.own(on(this.selectLayerAttribute, "change", lang.hitch(this, this.onAttributeLayerChange)));
        }
        if(spatialOptions.length === 1){
          this.own(on(this.selectLayerSpatial, "change", lang.hitch(this, this.onSpatialLayerChange)));
        }
        this.own(on(this.selectExpression, "change", lang.hitch(this, this.onAttributeLayerExpressionChange)));
        this.own(on(this.list, 'remove', lang.hitch(this, this._removeResultItem)));
      },

Thank you Robert. I just replace this:

Widget.html

<div data-dojo-type="widgets/eSearch/List" data-dojo-attach-point="list" data-dojo-attach-event="click:_selectResultItem"
class="esearch-list"></div>

to:

<div data-dojo-type="widgets/Dispo/UC/eSearch/List" data-dojo-attach-point="list" data-dojo-attach-event="click:_selectResultItem"
class="esearch-list"></div>

and then, it worked.

Greetings.

Awesome, that worked !!

Been using this widget for some time now and love it, but having a issue with it since i upgraded to 2.4. I loaded the new eSearch posted and i can not switch search layers. I noticed this is how it is on the live preview site also.  

Thank You,

Scott

Scott,

   Get version 2.4.0.2 which has that issue fixed. Sorry for the inconvenience.

thank you, it works!!

Hi Robert,

I am not sure if this is a service or search widget issue, but I recently republished a web service to a new location on our server and when I point the esearch widget to this new url my Unique value searches never populate the pull down menu, it seems to just spin finding the records. I just downloaded the newest one and started from scratch and still get the same error. The old service works just fine and when comparing the new and old services I do not see any difference. Any ideas? Thanks.

Emily,

   What does the browsers web console say?

Thanks for the response. Here is the console error, it looks like the query is launching over and over trying to populate the pull down menu. I have not changed the code manually so not sure what the syntax error would be.

Emily,

  Nothing is attached to your reply?..

Sorry, I replied through email so the attachment must not have come through, hopefully you can see it now.

Console Error

What does the SQL for that layer look like?

The service url is not public, what is the best way to let you know what the SQL looks like without the REST service?

Emily,

  Just open the config_eSearch.json and copy the sqltext for that layer into your reply.

Oh, right.

I am trying to make a big upgrade from WAB v 1.2 with Enhanced Search v 1.1.6  to WAB v 2.4 and Enhanced Search v 2.4.0.2.  My question is should I be able to somehow upgrade or import my eSearch config settings without having to manually re-create some 15 query layers?  First few tries to use my old config file have not worked.  This might be wishful thinking.

Michael,

   1.1.6 to 2.4.0.2 is a big jump and may be pushing it. You can try though. Here is what I would do. Add the eSearch to WAB 2.4 and open the widget setting dialog and make a simple change like changing a layers name (on the default layers that are listed). Save the app and open the apps configs/eSearch/folder and paste your old eSearch config.json in there and delete the other one. Now make sure that your 1.1.6 version json is named config_eSearch.json. Restart WAB and open the widgets settings dialog and make sure your old 1.1.6 json layers are still there. That's it.

Emily,

   It looks like you are getting 26000 unique records processed and then it is finding a ">" character in your fields data. Can you verify that your layers field data does not contain special characters.

This same thing is happening on all three fields in this layer in which I created pull-downs. Here is the test url that should be visible to the outside. The fields that are experiencing this issue are under Surveys and are Surveyor Name, Business, and Township/Range. The other weird thing is that I have not changed the data or data source between the working and non-working versions, the only thing that changed is where I published the service along with a new service url.

ArcGIS Web Application 

There seems to be issue with your service. I get a "The requested URL was rejected. Please consult with your administrator." when trying to access the rest url for the services/Surveyor/SurveyMonumentWAB/MapServer/2 url.

Unfortunately our server team has blocked browser access to these urls outside of our network. We have to view them on a test server which is internal only. Here is the json result from the query. I am not sure what special characters to be looking for that would be causing a problem. Does this help?

Emily,

  Run this query on your internal test server and see if it returns ok

https://slco.org/slcogis/rest/services/Surveyor/SurveyMonumentWAB/MapServer/2/query?f=json&where=&re... 

It seems to, I just put the url in a browser using the test server url, hope that was the correct method. Here are the results.

Emily,

   That should not be the result of the url I provided. the out field should be SURVEYOR not DOCUMENT_N...

This should be better.

Emily,

   OK so the issue seems to be only when the url I provided is used outside your network. This seems like something you need your IT Dept to look at.

Thank you for your help! I am guessing there is a permissions issue on the new url service location.

Hi,

This is a great widget!  

I seem to have a small bug with the Results Menu.  Upon first display, the menu text does not display correctly.  See the attached image.  Any suggestions?  It seems to correct  itself after one use. Also, I do not see the issue on Roberts "Live Preview" using the same Chrome browser.

Devon,

   That issue was fixed in the 2.4.0.2 release. Did you get that release?

Hi,

This is a great widget!  

I seem to have a small bug with the Results Menu.  Upon first display, the menu text does not display correctly.  See the attached image.  Any suggestions?  It seems to correct  itself after one use. Also, I do not see the issue on Roberts "Live Preview" using the same Chrome browser.

Hi Robert,

I downloaded on 5/12/17.  The older enhancements text file notes 2.3.  It might just be 2.4 without the incremental update.  I cant find the version/read-me off hand.

Devon,

   Hold the Alt key and click on the widget body and it will tell you which version of the widget you are using.

Okay, thanks.  I might have downloaded just before the incremental release.  I assume I will need to replace the widget folder and reconfigure the expressions to update the widget.  That is not too difficult at all though. Thank you very much for the prompt responses!

Devon,

   Once you replace the eSearch widget folder that is all you will have to do since the config_eSearch.json file is maintained in a seperate folder you will not loose your widget configuration.

Robert,

That's great, thanks again.

I downloaded the widget linked on this page, replaced the eSearch widget, saved and published my app, but the widget version did not change to 2.4.0.2 and the Results menu issue still exists.  I am not sure what could be wrong, it seems pretty straight-forward.  Devon

Devon,

   Hmm... Are you replacing the eSearch folder in the widgets folder on your web server? I sounds like you have replaced the eSearch widget in the stemapp folder in your WAB Dev and you did not replace the eSearch widget in the actual app that you are downloading. A bit of explaination on how WAB works the stemapp is the template of the app that you build when you create a new app. When you create a new app WAB copies the widgets and jimu core files into the new app folder (i.e. [install dir]\server\apps\[app#]). this only happen when the app is created. So updating the stemapp widgets will only affect NEW apps. If you want to update a widget in a existing app then you have to update the widgets folder in that specific app.

Hi Robert,

That helps a lot.  Thank you.  I replaced the widget in both locations.  Now, when I "launch" the app from within Web AppBuilder for ArcGIS, the widget version displays 2.4.0.2. But, when I download the app and place it in the inetpub folder, the app somehow does not show the update.  I have cleared internet history. Seems odd...

Devon,

   A couple of recommendations then. Replace the eSearch widget folder directly in the inetpub website folder. Two if you are using Chrome start an incognito window and test the app there.

Robert,

That worked!  Thank you.  

Hi Robert Scheitlin, GISP

I am not sure if it has been asked before. I am trying to configure the enhanced search widget to have text symbol (esriTS in the symbology of layer within config) where I can specify the field whose value should be shown as the text symbol. Is it already built in this widget or I need to customize?

Zeeshan,

   To be honest in all the years I have had the eSearch widget out there you are the first to ask for searching on a feature using a textSymbol. So yes this would require customization.

Robert,

I've tried searching for this but i have not be able to find an answer to my question specifically to your Esearch widget. I am currently using your widget and when doing a search for a certain item i noticed that the zoom is way to close. I would like to change the zoom to zoom out further when a result is returned. When i searched i found how to change the zoom level on WAB Search widget but not on your Esearch Widget. none less i tried adding the code you posted on this post but no luck. I might just not be seeing it correctly.

Thanks.

Hi Robert Scheitlin, GISP,
I have also been looking into a buffer on features. I am trying to use a selection as the starting point for Geometry, and based on user input for distance and color scheme/Line type will generate a buffer as an operational layer.

I have been looking into you Identify and your eSearch widgets. And trying to get the parts of what I want from it, but of course, it is becoming quite a barbaric task that I might be losing at.

 

So given the specs:

- user selected color and line type for buffer

- feature selection on the map (point/polygon type graphic)

- text-based distance input

 

Do you have any advice to get this going? I have spent a few days so far on my mentioned method and feel lost in the progress.

The eSearch accomplished almost all of what I need; just missing the color scheme for buffer graphic.

Thanks for any help you might be able to offer.

Hi Robert,


I am using your eSearch widget (the latest edition ) with WAB DE 2.4. It is great!

But..

I have a question.

Edit field format inputs are not reflected in the search results' attribute table

i.e. Specifying Precision and Use Thousands Separator does not get reflected in the attribute table results as well as the order of the fields that you specify with arrows in the included fields area.

When I look at config_eSearch.json I see my customizations there, but not in WAB.

Any advice would be greatly appreciated!

Thank you,

Nadia

Version history
Last update:
‎11-22-2022 07:31 AM
Updated by: