English

Problem: Empty Recordset returned by Java Connector when displayFeatures used

Description

Your Recordset is empty when you perform both of the following:

You call the 'displayFeatures()' method of the Map object; you then use the 'setFilterObject()' method for a FeatureLayers.

Cause

For each displayFeatures() method called, a 'Highlight Layer' is added to the map.

Setting a filter will not work if there is at least one existing HighlightLayer in the Layers collection.

Solution or Workaround

Remove all HighlightLayer present in the Layers collection.

Use the code below to loop through the Layers and remove HighlightLayer in the list, as given below:

Code:

map.displayFeatures(fl, firstWhere, false, mySymbol);
map.displayFeatures(fl, secWhere, false, mySymbol);
map.refresh();

int index = 0;
while(true){
String layerName = map.getLayers().item(index).getName();
if (layerName.equals("HighlightLayer"))
map.getLayers().remove(index);
else index++;

if (map.getLayers().getCount()==index) break ;

}