English

How To: Perform a Filter Query after a Buffer Query on the Same Map Object

Summary

Instructions provided describe how to perform a Filter Query after a Buffer Query on the Same Map Object. When using ArcIMS Java Connector, if you attempt to perform a filter query after a buffer query, the filter query may fail, regardless whether the filter query is performed on the same layer as the buffer query or not.
The reason is that the Java Connector memorizes the previous buffer information and the filter query is not correctly built. The solution is to clear the previous buffer information completely before perform the filter query.

Procedure

  1. For ArcIMS 9.1, use the code given below. In the code, 'tLayer' is the target layer in the buffer query, 'fLayer' is the original layer and function clearBuffer() is a new function introduced at ArcIMS 9.1 to clear the buffer information.

    Code:
    tLayer.getRecordset().clearRecordset();
    tLayer.getRecordset().clearGeometry();
    fLayer.setFilterObject(null);
    tLayer.setFilterObject(null);
    map.createBufferImage(false, false);
    map.clearBuffer();

  2. For ArcIMS 4.x and 9.0, create a new Map object and apply query to the Layer obtained from this new Map.

    Code:

    Map map2=new Map();
    FeatureLayer selectLayer = (FeatureLayer)map2.getLayers().item(4);
    Filter selectFilter= new Filter();
    ...
    selectLayer.setFilterObject(selectFilter);
    map2.refresh();
    Recordset records =selectLayer.getRecordset();