Quick tour of queries

Queries provide a means of asking questions about the features of a map service and getting results that meet the criteria you specify. For example, a query for earthquakes could ask for recent earthquakes of a certain magnitude or greater. Queries are saved in the map, and each is associated with a specific layer or sub-layer.

A query may be defined with specific criteria, in which case the query only needs to be executed to see the results. This is useful when the attribute information associated with the layer's features changes - if you are interested in tracking change on a regular basis, you can reexecute the same query at different times. Alternatively, a query may be defined so that one or more of the values to use in the query must be entered each time the query is run. This type of query is referred to as parametric.

Running existing queries and showing the results

Click the Queries button on the toolbar to show the Queries panel, which lists all queries in the current map. Execute a query by clicking on the Execute icon next to the query. If the query is parametric, a dialog box will appear with a message prompting you to enter a value to complete the query.

The results of a query are displayed both on the map and also listed in the Query Results panel, where you can see all the features which satisfy the query, and zoom to the extent of a specific feature, or to all of the features. When you click on a feature in the list, the feature is highlighted on the map, and vice versa. Click the arrow next to the feature to see more attributes.

The Queries panel and the results of the query, which are also highlighted on the map

You can rename, remove, or change the order in which queries are listed by clicking Organize at the bottom of the panel. You can also click the Properties button next to a query when in organize mode, to change its criteria.

The Queries panel list in organize mode

Creating new queries or changing the properties of existing queries

You can create a query for any layer or sublayer in the map, provided it has been published with a query service, by clicking the + button at the bottom of the panel. This opens the Query Definition dialog box where you can define the criteria of the new query in the Query tab by using the Field, Operator and Value controls. You can create a parametric query (one that asks the user for criteria values when the query is executed) by checking the Prompt for value checkbox. Enter a Default value, Prompt and Hint to help the user enter an appropriate value when the query is executed.

The Query Definition dialog box with criteria for a query

Use the Display Fields tab to control which attribute fields will be shown in the Query Results panel detailed view. You can see an extract of some data from the layer in the Data tab, which may help you when constructing your query.

The Display Fields tab in the Query Definition dialog boxThe Data tab in the Query Definition dialog box

Learn more about:

Using queries

Creating queries

Alternatively, if you have a layer based on a feature service, or based on a sublayer of a map service, you can define a query to filter the features that are visible in the map.

Learn more about filtering features

If you want to present a dynamic, graphical view of information extract from the features in a specific layer, you may want to use the Dashboard instead of a query.

See a quick tour of using dashboards


3/11/2013