AnsweredAssumed Answered

Streamlayer's definitionExpression doesn't seem too work

Question asked by cspan_TensingInternational on Oct 12, 2016
Latest reply on Oct 12, 2016 by cspan_TensingInternational

I am trying to add a streamlayer to my javascript api 4.0 webapp. Its a stream of vehicle positions, with some added attributes, for instance, a status field.

Now I want to add a filter to only show the vehicles with status = 1.

 

So in short, the basic code looks like this:

var streamLayer = new StreamLayer({

  url: lyrUrl,

  definitionExpression: "Status=1",

  purgeoptions: {

    displayCount: 500

  }

});

map.Add(streamLayer);

 

The layer is hosted on an arcgis for server 10.4.1 installation with the matching geoevent extension.

The StreamService has Store Latest activated.

Also, when I update a vehicle so it's status changes, I do see the change on the feature's attributes.

 

I would expect when a vehicle changes from 1 to 2, that it disappears from the map view. However, this doesn't happen.

v4.1 shows the same behavior, although that version has some other showstopping bugs that won't allow me to upgrade just yet.

 

Does anybody have a working sample of using a server side filter with a v4 StreamLayer? Are there any (un)documented prerequisites that I missed?

Outcomes