Query Widget Result Item Contents

11746
33
Jump to solution
03-25-2015 10:53 AM
TonyGroeneveld
New Contributor III

For the Query widget you can define which fields, alias, special type and order of  the results.  I have had no luck making these changes work or stick.

For example if you change the alias, special type or order of the result item contents and click ok.  None of the changes are saved.

0 Kudos
33 Replies
RobertScheitlin__GISP
MVP Emeritus

Kevin,

   Sounds like you need to contact tech support with your example use case, so they can confirm a bug in the widget or not.

KevinHatch
New Contributor III

will do. Thanks.

0 Kudos
NicholasBarger
Occasional Contributor III

I made some modifications to this widget around line 900.  See the code below.  It sorts the fields based on the layer id.  You may be able to add alias / order information to this to get the information on the screen corrected.

_queryByObjectIds: function(objectIds, returnGeometry){

        var queryParams = new EsriQuery();

        queryParams.returnGeometry = !!returnGeometry;

        queryParams.outSpatialReference = this.map.spatialReference;

        queryParams.outFields = this._getOutputFields();

        queryParams.objectIds = objectIds;

       

        var layerId = this._getLayerIndexByLayerUrl(this.currentAttrs.config.url);

        if (layerId === 15){

          queryParams.orderByFields = ["STATION"];

        }

        else

        if (layerId === 16){

          queryParams.orderByFields = ["DEPARTMENT"];

        }

        else

        if (layerId === 17){

          queryParams.orderByFields = ["STATION"];

        }

        else

        if (layerId === 18){

          queryParams.orderByFields = ["NAME"];

        }

        else

        if (layerId === 36){

          queryParams.orderByFields = ["SITE_NAME"];

        }

        else

        if (layerId === 31){

          queryParams.orderByFields = ["NAME01"];

        }

        else

        if (layerId === 32){

          queryParams.orderByFields = ["PARK_NAME"];

        }

        else

        if (layerId === 33){

          queryParams.orderByFields = ["Name"];

        }

        else

        if (layerId === 29){

          queryParams.orderByFields = ["Name"];

        }

        else

        if (layerId === 30){

          queryParams.orderByFields = ["AGENCY_CD"];

        }

        else

        if (layerId === 38){

          queryParams.orderByFields = ["NAME01"];

        }

        else

        if (layerId === 39){

          queryParams.orderByFields = ["NAME"];

        }

        else

        if (layerId === 10){

          queryParams.orderByFields = ["Name"];

        }

        else

        if (layerId === 11){

          queryParams.orderByFields = ["NAME"];

        }

        else

        if (layerId === 13){

          queryParams.orderByFields = ["Cemetery"];

        }

        else

        if (layerId === 12){

          queryParams.orderByFields = ["Precinct"];

        }

       

        var queryTask = new QueryTask(this.currentAttrs.config.url);

        return queryTask.execute(queryParams);

      },

Hope it helps.

KevinHatch
New Contributor III

I figured out our problem.  It is probably an eye rolling rookie mistake.  One of the maps was referencing the layers on our web server and one on our app server.  The ones referencing the app server didn't have the query limit restriction, the the ones referencing the web server did.  I was referencing our web server when adding the layer URL manually.