QueryTask  retrieves same results when query.where changes

496
1
06-16-2011 11:06 AM
PeteVitt
Occasional Contributor III
Im having an issue where the query task returns the same results even when the query.where changes -- Is there something I need to do to reset the querytask or something?  Below is my code:
public function GetPipeSegs(sReach:String, segIDOrderS:String, segIDOrderE:String):void
   {
    //get the pipe segs between the manholes
    var QueryTaskSegments:QueryTask = new QueryTask("http://www.sawpa.net/ArcGISSAWPA/rest/services/sari_maint/MapServer/1");
    QueryTaskSegments.concurrency="last";
    var aQuery:Query=new Query();
    var sFilter:String;
   
    sFilter = "Reach = '" + sReach + "'";
    sFilter += " and SegIDOrder >= " + segIDOrderS;
    sFilter+=" and SegIDOrder <= " + segIDOrderE;
   
    Alert.show(sFilter);
    aQuery.outSpatialReference=thisMap.spatialReference;
    aQuery.returnGeometry=true;
    aQuery.outFields=["FacilityID","SegIDOrder"];
    aQuery.where=sFilter;
    aQuery.geometry=thisMap.extent;
    QueryTaskSegments.execute(aQuery, new AsyncResponder(onQuerySuccessSegments, onQueryFail));

   }

public function onQuerySuccessSegments(aSet:FeatureSet, token:Object=null):void
   {

    var resultCount:int=aSet.features.length;
    /*Alert.show(FindMaintFac_Prop.SegIDOrderStart.toString(),"Start Seg");
    Alert.show(FindMaintFac_Prop.SegIDOrderEnd.toString(),"End Seg");
    Alert.show(FindMaintFac_Prop.Reach.toString(),"Reach");
    Alert.show(FindMaintFac_Prop.MHID.toString(),"Downstream MH");
    Alert.show(FindMaintFac_Prop.MHIDUS.toString(),"UpStream MH");*/
    Alert.show(aSet.features[0].attributes.FacilityID.toString(),"first Facility");
    Alert.show(aSet.features[resultCount - 1].attributes.FacilityID.toString(),"last Facility");
    Alert.show(resultCount.toString());
   
   }
Tags (2)
0 Kudos
1 Reply
PeteVitt
Occasional Contributor III
the problem was the geometry filter:
aQuery.geometry=thisMap.extent;


I had a procedure that would zoom in to features on the map and that would limit the output to the extent of the map
0 Kudos