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

717
1
08-20-2018 09:45 AM
ShawnCastrianni
New Contributor II

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?

0 Kudos
1 Reply
ShawnCastrianni
New Contributor II

I can easily do this in a web browser by accessing the web interface to Query for that feature layer and specifying the OutField AND specifying DISTINCT as shown in this attachment:

0 Kudos