AnsweredAssumed Answered

DefinitionExpression with MapImageLayer subLayer

Question asked by randybonds on Jan 10, 2017
Latest reply on Jan 10, 2017 by randybonds

I'm having trouble with a complex definitionExpression in a sublayer of my MapImageLayer (JSAPI 4.2). When I do the same query from the REST service directory, it works perfectly. 

 

More or less, I want a date range and either of two other field values to be 1. What happens is that the points are all shown, but only the ones that match the query have a popup... it's really neat.

 

Here's my code

 

        var layer = new MapImageLayer({
          url: "https://gis.yakimawa.gov/arcgis101/rest/services/CouncilDistricts/ElementarySchoolSidewalksAnalysis/MapServer",
          sublayers: [
          {
            id: 4,
            visible: true,
            definitionExpression: "Type = 1",
            popupTemplate: template
          }, {
            id: 3,
            visible: true
          }, {
            id: 2,
            visible: true,
            popupTemplate: streetTemplate
          },{
            id: 1,
            visible: true,
            popupTemplate: streetTemplate
          }, {
            id: 0,
            visible: false,
            definitionExpression: "(Collision_Date <= date '2016-12-31 23:59:59' AND Collision_Date >= date '2014-01-01 00:00:00') AND (Number_of_Pedestrians_Involved > 0 OR Number_of_Pedalcyclists_Involve > 0)",
            popupTemplate: collisionTemplate
          }]
        });

Outcomes