Query Attributes task

The Query Attributes task helps users select or view certain data on the map based on that data's attributes. A Query Attributes task creates a single query on one map layer. However, the query can have compound criteria. For example, you can define a query on a cities layer that selects cities with a population greater than a value entered by the user and with a name that begins with a value entered by the user.

Additionally, the Query Attributes task supports relates and stand-alone tables. Relates simply define a relationship between two tables without appending the associated data in each table. In many cases, the relates point toward stand-alone tables, which lack geometry but often contain valuable attribute information. For example, if you published a map service that contained relates between city parcels and a stand-alone table of parcel owners, you could use the Query Attributes task to display the owners and location of the parcel in the query results.

When you configure the Query Attributes task, you create an easy-to-understand form that will guide the user through the process of making the query. This way, users of your application will not have to know the details about the dataset, nor will they have to construct a Structured Query Language (SQL) statement to query the data.

For example, suppose you wanted users to select U.S. counties by entering a state name and a minimum average household size. A SQL expression for this selection might look something like this: SELECT * FROM counties.sdc.counties WHERE: "STATE_NAME" = 'Idaho' AND "AVE_HH_SZ" > 3.0. The users of your Web application might not know the field names of your data or how to write a SQL statement. You can help them by using the Query Attributes task to create an easy-to-read form with text like the following: I want to select counties in the state of: (user picks a state from a drop-down list) whose average household size is greater than or equal to: (user types a number in a text box).

After adding a Query Attributes task to your application, click the Configure button to display the task configuration settings. You use this dialog box to build the query and to specify the wording that a user sees when the task is displayed. You can also adjust how the results will be displayed.

Choosing the text to appear in the task

The General tab allows you to fine-tune the wording that users will see when they run your task. You can change the following:

Building the query

Use the Settings tab to build your query. After selecting a map service and a layer to query, click the Add button to add a condition to your query. You can add multiple conditions to create a compound query. If you're new to SQL or you need a review, a good place to start is Building a query expression in the ArcGIS Desktop Help.

The example above shows a query condition allowing the user to enter a value and find counties with a population greater than that value.

Remember the following points when setting up a Query Attributes task:

Choosing how results will be displayed

Use the Results tab to configure how task results will appear. It's helpful to know the following:


11/18/2013