AnsweredAssumed Answered

Query feature layer distinct attribute values for creation of pick list?

Question asked by scastrianni on Aug 20, 2018
Latest reply on Aug 20, 2018 by scastrianni

I am trying to build a pick list to show in my UI to allow the user to select a value from the pick list to control the DefinitionExpression of the feature layer in the map.  In a regular SQL DB, I would do a select distinct field_name from table order by field_name to build this pick list.  I need to do the same thing for a feature layer.

 

I can see that I can QueryFeatures on a ServiceFeatureTable, and then inspect the returned features to build my pick list.  But this is VERY INEFFICIENT.  To improve efficiency, I have specified NOT to return the geometry since that is not required to build the pick list.  But even then, it is VERY INEFFICIENT since it is returning ALL the attributes for ALL the features. I ONLY need the DISTINCT attribute values, not the actual features themselves.  It would be helpful if I could at least specify the OutFields so that I can request ONLY the attribute I need to build my pick list.  But even this would not be ideal since I want DISTINCT values.

 

What can I do?

Outcomes