Greetings,
I'm developing an Android app (Java) using the Runtime SDK for Android.
I'm trying to create a definition condition for a FeatureLayer, to only show features with 'Tipo = Autotanque' and with 'Capacidade > 500 (liters)'.
I tried the following lines of code:
featureLayer.setDefinitionExpression("Tipo = 'Autotanque' WHERE CAPACIDADE > '500'");
featureLayer.setDefinitionExpression("Tipo = 'Autotanque' AND CAPACIDADE > '500'");
After testing only the first part of the expression (Tipo = 'Autotanque'), it worked, but the second part of the definition expression is not being read properly as no features are shown.
Please guide me on how to build this expression.
Thank you very much in advance.
Cheers
Solved! Go to Solution.
Hi,
What field type is CAPACIDADE? If it's numeric then you may need to omit the ' ' around the value
e.g. req_Type = 'Tree Maintenance or Damage' AND req_id > 40000
You can test this specific example here: Query: Incidents (ID: 0) (arcgis.com)
Cheers
Hi,
What field type is CAPACIDADE? If it's numeric then you may need to omit the ' ' around the value
e.g. req_Type = 'Tree Maintenance or Damage' AND req_id > 40000
You can test this specific example here: Query: Incidents (ID: 0) (arcgis.com)
Cheers
I accepted this answer as the solution. I found out I had some features not prepared to be queried. After deleting the malfunctioning features, my query went through as successful.
I used the following query
"Capacidade > 500 AND Tipo LIKE 'Autotanque'"
I decided it was more convenient to use FeatureLayer.queryFeaturesAsync rather than the FeatureLayer.setDefinitionExpression.
Cheers
Hello Michael,
Thank you very much for your reply.
I decided it's more convenient to use QueryPameters in FeatureLayer.queryFeaturesAsync for the purpose I want.
Regarding your question, it is a numeric field. I also tried without the quotes ' and had the same result (forgot to mention that).
Thank you very much for your reply
... if you're looking for client-side display filtering you might also consider using Display Filters: Query | ArcGIS Runtime API for .NET | ArcGIS Developers