AnsweredAssumed Answered

FeatureLayer Queries not returning anything

Question asked by cwhi095 on Jul 27, 2014
Latest reply on Jul 27, 2014 by cwhi095

I'm having trouble getting (offline) Feature Layer queries to return expected results. If I do a simple query with a Where 1=1 clause I get all features as expected. If I do a query with the a Where 'AreaName' = 'example' I get no results but no error message either. I have tested the same query in ArcMap and against the Feature Server on ArcGIS server and both work as expected. When I do the first query I can see that there is data that should satisfy the query in the Feature Layer but it is not being returned.

 

I am using the following code:

 

QueryParameters params = new QueryParameters();
params.setWhere("'AreaName' = '" + areaName + "'");
                
featureLayer.getFeatureTable().queryFeatures(params, new CallbackListener<FeatureResult>() {
    
    @Override
    public void onError(Throwable e) {
        //Handle error
    }
    
    @Override
    public void onCallback(FeatureResult objs) {
        ArrayList<String> items = new ArrayList<String>();
        
        for(Object o : objs){ 
            if(o instanceof Feature){
                Feature f = (Feature) o;
                String item = (String) f.getAttributeValue("Line");
                
                if(item != null && !items.contains(item)){
                    items.add(transect);
                }
            }
        }
}

 

Is there anything wrong with the way I am doing the query?

Outcomes