AnsweredAssumed Answered

Issue Setting Layer Definition on Feature Layer

Question asked by chagan02 on Sep 12, 2017
Latest reply on Sep 13, 2017 by TSolow-esristaff

Hi everyone,

 

I have an app that pulls in an AGOL feature layer which contains nearly 15000 features.  I would like the app to do two things, the second I already have setup, it's the first that I can't figure out.

 

1.  I need the page to pull in only certain features that meet a specified definition query.  Which doesn't seem to work.  I tried using this example Feature layer with layer definition applied | ArcGIS API for JavaScript 3.21 however when I pull the feature in, the definition set doesn't hold, thus it returns features that I know don't meet the query.

 

2. This could be causing issue one, but I'm not sure.  Later in the JS I have another function that sets another definition expression on the same layer, which doesn't contain the original definition.  This part works, but as stated, the first definition doesn't work.  Is this actually overriding the first query?

 

For example, say I have 1000 features that are in the state of SC among a feature layer that contains all 50 states.  Those same features in SC have an attribute for county.  What I want to be able to do is, when the page loads using FeatureLayer Mode SNAPSHOT, ONLY pull into memory the state of SC, then later in the code set another expression to get only those in a particular county.  Thus in the end, only return the features in SC in X county.   This page always works in SC, thus I just wanna set that at the top, then do a more dynamic query later in the code for varying counties. 

 

Is this possible?

 

Thanks,

Charles

Outcomes