Packagecom.esri.aws.services
Classpublic class SearchOptions

Contains parameters for a search. Input request for Spatial Query.

View the examples.



Public Properties
 PropertyDefined by
  orderByList : Array
The field value to use for sorting the results of records that are of equal distances (0.0).
SearchOptions
  resultSetRange : ResultSetRange
The range of results to be returned.
SearchOptions
  returnFields : Array
The field names to be returned.
SearchOptions
  whereClause : String
The SQL WHERE clause to limit search results.
SearchOptions
Property detail
orderByListproperty
public var orderByList:Array

The field value to use for sorting the results of records that are of equal distances (0.0). Currently, only one value is valid (an array of more than one value returns an error).

resultSetRangeproperty 
public var resultSetRange:ResultSetRange

The range of results to be returned.

returnFieldsproperty 
public var returnFields:Array

The field names to be returned. List the field names in the order you would like them displayed. For Spatial Query, use the method getAvailableFieldNames to see possible fields. By default, all the fields associated with a given data source are returned.

whereClauseproperty 
public var whereClause:String

The SQL WHERE clause to limit search results. The following operators work in a WHERE clause: =, >, >=, <, <=, <>, AND, OR, LIKE, BETWEEN, IN, NOT IN. The following are not valid: ORDER BY and DISTINCT. Invalid WHERE clauses are ignored.

Examples
Basic_SpatialQuery_without_map
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:awx="http://www.arcwebservices.com/2007/awx"
    pageTitle="Basic SpatialQuery - findFeaturesByPoint()"
    implements="mx.rpc.IResponder"
    creationComplete="onComplete()"
    >
    <mx:Script>
        <![CDATA[
            import com.esri.aws.awx.geom.GeoPoint;
            import com.esri.aws.osgi.framework.ServiceTracker;
            import com.esri.aws.osgi.framework.IServiceReference;
            import com.esri.aws.services.ISpatialQuery;
            import com.esri.aws.services.ResultSet;
            import com.esri.aws.services.ResultSetRange;
            import com.esri.aws.services.SearchOptions;
            import com.esri.aws.services.SpatialQueryOptions;

            import flash.utils.getQualifiedClassName;
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.rpc.IResponder;
            
            private var spatialTracker:ServiceTracker;
            
            private function onComplete():void
            {
                spatialTracker = new ServiceTracker(Framework.getInstance().systemContext, getQualifiedClassName(ISpatialQuery));
                spatialTracker.open();
            }

            private function doQuery():void
            {
                var spatialService:ISpatialQuery = spatialTracker.getService() as ISpatialQuery;
                
                if (spatialService)
                {
                    //build some simple options to return the closest state/province polygon
                    var sqOptions:SpatialQueryOptions = new SpatialQueryOptions();
                    sqOptions.dataSource = "ArcWeb:ESRI.AdminAreas.World";
                    sqOptions.returnDistance = true;
                    var s2:SearchOptions = new SearchOptions;
                    var s3:ResultSetRange = new ResultSetRange;
                    sqOptions.searchOptions = s2;
                    s2.resultSetRange = s3;
                    s3.count = 1;
                    spatialService.findFeaturesByPoint(new GeoPoint(-117, 33), sqOptions, this);
                }
            }
            
            public function result(data:Object):void
            {
                try {
                    var rs:ResultSet = ResultSet(data);
                    for(var j:int = 0; j < rs.rows.length; j++)
                    {
                        for(var k:int = 0; k < rs.fields.length; k++) {
                            log.htmlText += "<b>" + rs.fields[k].name + ":</b> " + rs.rows[j].fieldValues[k] + ".<br>";
                        }
                    }
                }
                catch(error:Error)
                {
                    Alert.show(error.message);
                }
            }
            
            public function fault(info:Object):void
            {
                Alert.show(info.toString());
            }
        ]]>
    </mx:Script>

    <awx:Framework id="m_framework" apiKey="[MY-API-KEY]">
        <awx:SpatialQueryActivator/>
    </awx:Framework>

    <mx:Button label="Run a SpatialQuery" click="doQuery()"/>
    <mx:Panel title="SpatialQuery Results">
        <mx:TextArea id="log" minHeight="200" minWidth="300"/>
    </mx:Panel>
</mx:Application>