eSearch 2.12 potential issue - Query Layers

1705
26
Jump to solution
09-26-2019 11:59 PM
RodWoodfordOld
Occasional Contributor III

Hi Robert,

I'm currently using eSearch 2.12 and am experiencing issues when using query layers with unique value settings. No options are returned even for small services. I have upgraded from 2.6 where I had no issue with the same query layers. Any advice would be useful.

cheers

0 Kudos
26 Replies
RobertScheitlin__GISP
MVP Emeritus

Rod,

   Well that is odd. Do you have an app that I can hit publicly that has the issue and the fixed code I provided?

0 Kudos
RodWoodfordOld
Occasional Contributor III

Yep I can set that up.

Can you tell me what you changed in the code? I cant see a difference between what you posted and the original.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

This is the change (added lines 47 - 48):

      execute: function () {
        this.uniqueValues = [];
        this.blankStringExists = false;
        this.iStart = 0;
        this.iMaxRecords = 0;
        this.featuresProcessed = 0;
        this.featuresTotal = 0;

        this.isQuerying = true;
        this.query.returnGeometry = false;
        this.query.outFields = [this.fieldName];
        if (this.version > 10.11) {
          this.query.orderByFields = [this.fieldName];
        }
        this.query.objectIds = null;
        if (this.defExpr && this.defExpr !== "") {
          this.query.where = this.defExpr;
        } else {
          this.query.where = "1=1";
        }
        if (this.uri === '') {
          this.emit('pagingFault');
          return;
        }
        // console.info(this.uri);
        this.queryTask = new QueryTask(this.uri);
        if (this.version >= 10.1) {
          //need to check if the feature count is over maxRecordCount
          var cntQuery = new Query();
          if (this.defExpr && this.defExpr !== "") {
            cntQuery.where = this.defExpr;
          } else {
            cntQuery.where = "1=1";
          }
          cntQuery.returnDistinctValues = true;
          cntQuery.outFields = [this.fieldName];
          this.queryTask.executeForCount(cntQuery, lang.hitch(this, function(count){
            this.featuresTotal = count;
            if(count <= this.maxRecordCount){
              this.allValues = [];
              this.query.returnDistinctValues = true;
              this.queryTask.execute(this.query, lang.hitch(this, this.onSearchFinish), lang.hitch(this, this.onSearchError));
            }else{
              delete this.query.orderByFields;
              this.queryTask.executeForIds(this.query, lang.hitch(this, this.onSearchIdsFinish), lang.hitch(this, this.onSearchError));
            }
          }), lang.hitch(this, function(err){
            this.queryTask.executeForIds(this.query, lang.hitch(this, this.onSearchIdsFinish), lang.hitch(this, this.onSearchError));
          }));
        } else {
          this.queryTask.executeForIds(this.query, lang.hitch(this, this.onSearchIdsFinish), lang.hitch(this, this.onSearchError));
        }
      },
0 Kudos
RodWoodfordOld
Occasional Contributor III

Thanks I'll try that and get back to you.

cheers

0 Kudos
RodWoodfordOld
Occasional Contributor III

That was it Robert. I added in lines 47 and 48 and it now works, fantastic. They didn't come through in the original post.

}), lang.hitch(this, function(err){
            this.queryTask.executeForIds(this.query, lang.hitch(this, this.onSearchIdsFinish), lang.hitch(this, this.onSearchError));
          }

I have also just noticed that at 2.12 the date fields wont clear when you select clear fields option. Do you have code fix for this.

cheers

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rod,

   I see now that the code I posted earlier did not have the changes as you mention. Sorry for the confusion there. 

I have also just noticed that at 2.12 the date fields wont clear when you select clear fields option

I just did a quick test and added a date field as part of a search expression and the clear fields does work for me...

Can you be more specific about your setup for that expression. My testing I added one date field with the operator of is on and I also tested is between and it worked fine.

0 Kudos
RodWoodfordOld
Occasional Contributor III

Thanks Robert,

I have resolved the date issue. Thank you for your fix re query layers. Can you advice when this fix is included in your next release.

cheers

0 Kudos