+ Reply to Thread
Results 1 to 4 of 4

Thread: Multiple Query

  1. #1
    Amanda Hutsel
    Join Date
    Apr 2012
    Posts
    25
    Points
    0
    Answers Provided
    0


    0

    Default Multiple Query

    Is it possible to perform multiple queries at the same time? For example, the application user might need to search for homes given $20,000 in 2009. These are two different attribute fields. I looked for example code and could find none for querying multiple attributes. Thanks, Amanda

  2. #2
    Robert Scheitlin

    Join Date
    Mar 2010
    Posts
    9,260
    Points
    5579
    Answers Provided
    938


    0

    Lightbulb Re: Multiple Query

    Amanda,

    Sure the QueryTask and Query supports most basic SQL styntax in the where attribute of the Query object.

    So if you take the "Query results on map" sample and change the query object like this it will work:

    http://help.arcgis.com/en/webapi/fle...000003q000000/

    Code:
    <fx:Declarations>
            <!-- Layer with US States -->
            <esri:QueryTask id="queryTask"
                            showBusyCursor="true"
                            url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"
                            useAMF="false"/>
            
            <esri:Query id="query"
                        outSpatialReference="{myMap.spatialReference}"
                        returnGeometry="true"
                        where="STATE_NAME like '{qText.text}%' AND POP2007 &gt; 500000">
                <esri:outFields>
                    <fx:String>MED_AGE</fx:String>
                    <fx:String>POP2007</fx:String>
                </esri:outFields>
            </esri:Query>
        </fx:Declarations>
    Don't forget to click the Mark as answer check on this post and to click the top arrow (promote) as shown below:
    Just because it's not the answer you want, does not mean that it is not the answer.

    Robert Scheitlin

    GIS Manager
    Calhoun County, Alabama


  3. #3
    Amanda Hutsel
    Join Date
    Apr 2012
    Posts
    25
    Points
    0
    Answers Provided
    0


    0

    Default Re: Multiple Query

    Is it possible to do this with a Feature Layer search or does it need to be a Graphics Layer Query?

  4. #4
    Robert Scheitlin

    Join Date
    Mar 2010
    Posts
    9,260
    Points
    5579
    Answers Provided
    938


    1

    Lightbulb Re: Multiple Query

    Amanda,

    Yes a FeatureLayer has a queryFeatures method on it just look at the documentation:

    http://help.arcgis.com/en/webapi/fle...tureLayer.html

    Don't forget to click the Mark as answer check on this post and to click the top arrow (promote) as shown below:
    Just because it's not the answer you want, does not mean that it is not the answer.

    Robert Scheitlin

    GIS Manager
    Calhoun County, Alabama


+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts