Streamlayer's definitionExpression doesn't seem too work

634
1
10-12-2016 02:21 AM
Casper_Span
New Contributor III

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?

Tags (1)
0 Kudos
1 Reply
Casper_Span
New Contributor III

Some new discoveries. When I set my definitionExpression it does filter a bit. It filters the streamlayer, but not the underlying feature class (the store latest)

I would expect that definitionExpression's would be passed down to the feature class as well... Can I force this behavior somehow?

0 Kudos