AnsweredAssumed Answered

[JSAPI] Limit Feature Layer by Query

Question asked by dkevinscalf on Aug 10, 2015
Latest reply on Aug 11, 2015 by dkevinscalf

Is there a way in the definition of a featureLayer via URL, to add some query string parameter to limit the returned results a feature layer and still function On Demand?

 

More detail: I have a feature layer hosted on a rest service that contains data from multiple lines in our system. I currently do this:

 

            featureLayer = new FeatureLayer(url, {

                mode: FeatureLayer.MODE_ONDEMAND,

                outFields: ["*"],

                visible: isVisible

            });

 

That works just fine, but it pulls data from every line and I really only want to view the data pertaining to one line at a time.

I would like to be able to do this:

 

          featureLayer = new FeatureLayer(url + querystring, {

                mode: FeatureLayer.MODE_ONDEMAND,

                outFields: ["*"],

                visible: isVisible

            });

 

I would like to add the query ("LINE_ID == ?") and still have it behave as it would in the first block of code where we pull the data On Demand as we're viewing the map.

 

Is there a way to accomplish this either on the API or Server side?

Outcomes