QueryBuilder Module
The QueryBuilder Module implements the Query Builder and Filter Builder.
Query Builder
WMS layers that are not associated with a WFS do not support query operations.
Stream layers cannot be queried.
The Query Builder enables end users to construct queries that search for specific features on a layer.
Query panel fields and options
|
Data Source: lists the feature layers. Select one from the list. |
|
Map Area: indicates the scope for the query. Select All or Current Extent. |
|
Find results area: Indicates the selected data source name that the query applies to. Select All of the following must be true to use the |
|
Expression fields: Select the query subject in the field on the left. Select the operator for the expression in the center field (the list of operators is dependent on whether the subject represents an alphanumeric or numeric value). Type the value being searched for in the field on the right. |
|
Add Condition: If All of the following must be true (the |
|
Add Subclause: Adds a nested clause to the expression. The subclause allows the user to nest an |
|
Search: Click Search to run the query. |
The results of a query are listed in the Query Results panel, and each item is highlighted on the map. The features do not need to be visible at the current map scale for highlighting to be shown.
For example, a user can define a query to search the Hospitals layer in the current map extent for medical facilities containing Center in the name. Clicking Search lists those medical facilities in the Query Results panel, and highlights each one on the map with yellow circles. If you place focus on a specific item in the list, the highlight color for that item changes to blue on the map. (See Highlight Module for information about highlighting and emphasizing features.)
Query entries |
Query Results List |
Highlighted results |
The user can click a medical center in the query results list to see additional details about it. (If the feature is visible on the map, they can also click it to open a map tip and click the View Additional Details link.)
To save the query, click the Query tab at the bottom of the Query Results panel, and click Save Query As in the Panel Actions menu. If the user changes a query that was previously saved, they click Save Query. Note that user-defined queries that are saved are available only in the current Viewer session. To save a query for use in a later session, the user needs to save the project.
Queries can be created by administrators in the HTML5 Viewer. Administrator queries are included in the Saved Queries panel as Administrator Defined queries, which are read only and they can be run by any user. (See Queries for information about creating administrator queries.) Users can edit administrator queries and use Save Query As to save a user-defined copy of the administrator query, but they cannot change the administrator query itself.
Filter Builder
The Filter Builder enables end users to filter the features that show on the map. Filtering does not affect which features are listed in search or query results. Filtering is the same as applying a definition expression in ArcMap.
The Filter panel contains the same fields and options as the Query panel, but it includes Clear and Filter buttons at the bottom rather than Search. (See Query Builder for information about the fields and options.) Clicking Filter shows the features specified in the Filter panel and hides those that do not match the filter criteria. Clicking Clear shows the features that were hidden by filtering.
For example, a user could filter the Hospitals layer for medical facilities with Hospital in the name that provide Emergency Services and are open 24 Hours. Clicking Filter hides medical facilities that are not hospitals with 24-hour emergency services. Clicking Clear re-displays the hidden features on the map.
As of Geocortex Viewer for HTML5 4.13, features of Stream layers can be filtered, however, all features are cleared before applying the filter, as existing features cannot be filtered. Stream layers cannot be queried.
Configure the Query Builder and Filter Builder
User added feature layers and dynamic layers can be queried and filtered without configuration.
To enable end users to use the Query Builder and Filter Builder, you must:
-
Enable Querying: Enable querying on the layers that you want users to be able to query and filter.
The Allow Query Operations setting controls whether a layer can be queried and filtered. You can configure the Allow Query Operations setting for a layer by editing the layer, by using the layer's drop-down menu, or by using a batch editing menu. For instructions, see Configure Layers.
-
Configure the Data Provider: Depending on the data provider that you use to store feature data, you might have to configure the data provider in Manager. In some cases, you might also have to configure some properties related to the data provider in the viewer's configuration files. Configuring the data provider enables the Query Builder and Filter Builder to construct queries using the correct syntax for your data provider. For instructions on configuring the data provider, see Functional Tab for Map Services.
-
Provide Access: You must provide a way for end users to access the Query Builder and Filter Builder.
-
Query Builder: To provide access to the Query Builder for end users:
-
Create a hyperlink, I Want To menu item, or workflow that uses the
ActivateView
command to activate the Query Builder's view:ActivateView(SimpleQueryBuilderView)
-
Add the Query tool to the toolbar.
For instructions on adding tools to the toolbar, see Toolbar.
Query tool
-
-
Filter Builder: To provide access to the Filter Builder for end users:
-
Create a hyperlink, I Want To menu item, or workflow that uses the
ActivateView
command to activate the Filter Builder's view:ActivateView(SimpleFilterBuilderView)
-
Add the Filter tool to the toolbar.
For instructions on adding a tool to the toolbar, see Toolbar.
Filter tool
-
-
Configuration Properties
If your data provider uses the ANSI SQL default standard or one of the well-known data providers that are listed in the (Default) Data Provider drop-down list in Manager, you do not need to configure these properties. You only need to configure these properties if your data provider uses some other query syntax.
The HTML5 Viewer supports the use of the following query tokens in Query Builder and Filter Builder format strings:
-
Field Name:
{0}
is substituted at run time for the name of a field in the layer that is being queried or filtered. -
Input Value:
{1}
is substituted at run time for the input value entered by the user. All input is text. -
Date Value:
{0:[date format]}
is substituted at run time for a date value. Replace[date format]
with the date format that your data provider uses.
Module
-
queryStatusRegion
: The region in the Query Results list used for query status messages. The default isQueryBuilderStatusRegion
for Desktop and Tablet interfaces, andResultsStatusRegion
for the Handheld interface. -
filterStatusRegion
: The region in the Filter panel used for filter status messages. The default isFilterBuilderStatusRegion
for Desktop and Tablet interfaces, andResultsStatusRegion
for the Handheld interface.
Views
-
SimpleQueryBuilderView
: This view is used when the end user selects the Query Builder.-
wildcard
: The character that your data provider uses as a wildcard. For example, the ANSI SQL default wildcard is%
. You cannot use query tokens in this format string. -
dateQueryFormat
: The date format that your data provider uses. The syntax of the date format is{0:[date format]}
, where0
is the field name and[date format]
is the date format that your data provider uses. Query Builder uses thedateQueryFormat
property to construct date queries.Your data provider's date format can contain any of the .NET date and time format specifiers that are listed below. For example, the date format for the ANSI SQL default data provider is
DATE: '{0:yyyy-MM-dd}'
. This uses three .NET format specifiers:yyyy
,MM
, anddd
.d
fffffff
h
s
dd
F
hh
ss
f
FF
H
y
ff
FFF
HH
yy
fff
FFFF
m
yyy
ffff
FFFFF
mm
yyyy
fffff
FFFFFF
M
yyyyy
ffffff
FFFFFFF
MM
-
textComparisonQueryFormat
: The format of a query that compares the value of a text field to the input value. For example, the format for text comparisons in the ANSI SQL default data provider isLOWER({0}) LIKE LOWER({1})
. -
numberToTextComparisonQueryFormat
: The format of a query that compares the value of a numeric field to the input value. For example, the format for number-to-text comparisons in the ANSI SQL default data provider isCAST({0} AS VARCHAR(50)) LIKE '{1})
. -
doesNotContainQueryFormat
: The format of a query that tests whether a field contains the input value. For example, the format for text comparisons in the ANSI SQL default data provider isLOWER({0}) NOT LIKE LOWER({1})
. -
allowDrawingsAsSpatialFilter
: When this property istrue
, users can limit the query to enclosed areas that are drawn on the map. For example, a user could draw several circles on the map and query only those features that lie within the circles. If you set this property tofalse
, the option to constrain query operations to polygon drawings is not available to end users.You cannot use query tokens in this format string.
-
queryProviderSupportsTimeOfDay
: If the data provider that you are using supports storing the time of day using Unix time, set this property totrue
. You cannot use query tokens in this format string. -
mode
: Themode
for this view isquery
. You cannot use query tokens in this format string. -
numberOfSuggestions
: The number of suggestions displayed by the autocomplete function of the value expression field. The default value is10
. -
defaultLogicalOperator
: The logical operator to be displayed when the query builder is initialized. The default value isand
.
-
-
SimpleFilterBuilderView
: This view is used when the end user selects the Filter Builder.-
wildcard
: The character that your data provider uses as a wildcard. For example, the ANSI SQL default wildcard is%
. You cannot use query tokens in this format string. -
dateQueryFormat
: The date format that your data provider uses. The syntax of the date format is{0:[date format]}
, where0
is the field name and[date format]
is the date format that your data provider uses. Filter Builder uses thedateQueryFormat
property to construct date queries.Your data provider's date format can contain any of the .NET date and time format specifiers that are listed below. For example, the date format for the ANSI SQL default data provider is
DATE: '{0:yyyy-MM-dd}'
. This uses three .NET format specifiers:yyyy
,MM
, anddd
.d
fffffff
h
s
dd
F
hh
ss
f
FF
H
y
ff
FFF
HH
yy
fff
FFFF
m
yyy
ffff
FFFFF
mm
yyyy
fffff
FFFFFF
M
yyyyy
ffffff
FFFFFFF
MM
-
textComparisonQueryFormat
: The format of a query that compares the value of a text field to the input value. For example, the format for text comparisons in the ANSI SQL default data provider isLOWER({0}) LIKE LOWER({1})
. -
numberToTextComparisonQueryFormat
: The format of a query that compares the value of a numeric field to the input value. For example, the format for number-to-text comparisons in the ANSI SQL default data provider isCAST({0} AS VARCHAR(50)) LIKE '{1})
. -
doesNotContainQueryFormat
: The format of a query that tests whether a field contains the input value. For example, the format for text comparisons in the ANSI SQL default data provider isLOWER({0}) NOT LIKE LOWER({1})
. -
allowDrawingsAsSpatialFilter
: When this property istrue
, users can limit the query to enclosed areas that are drawn on the map. For example, a user could draw several circles on the map and query only those features that lie within the circles. If you set this property tofalse
, the option to constrain query operations to polygon drawings is not available to end users.You cannot use query tokens in this format string.
-
queryProviderSupportsTimeOfDay
: If the data provider that you are using supports storing the time of day using Unix time, set this property totrue
. You cannot use query tokens in this format string. -
mode
: Themode
for this view isfilter
. You cannot use query tokens in this format string.
-
-
ListQueriesView
: Noconfiguration
properties -
ListFiltersView
: Noconfiguration
properties -
SaveQueryView
: Noconfiguration
properties -
SaveFilterView
: Noconfiguration
properties -
QueryActionsView
:-
menuID
: The menu ID for the view. The default value isQueryActions
.
-
-
FilterActionsView
:-
menuID
: The menu ID for the view. The menu ID for the view. The default value isFilterActions
.
-
View Models
-
SimpleQueryBuilderViewModel
: Noconfiguration
properties -
SimpleFilterBuilderViewModel
: Noconfiguration
properties -
ListQueriesViewModel
:-
mode
: The mode for this view model is"query"
. You cannot use query tokens in this format string.
-
-
ListFiltersViewModel
:-
mode
: The mode for this view model is"filter"
. You cannot use query tokens in this format string.
-
-
SaveQueryViewModel
:-
mode
: The mode for this view model is"query"
. You cannot use query tokens in this format string.
-
-
SaveFilterViewModel
:-
mode
: The mode for this view model is"filter"
. You cannot use query tokens in this format string.
-
-
QueryActionsViewModel
:-
mode
: The mode for this view model is"query"
. You cannot use query tokens in this format string.
-
-
FilterActionsViewModel
:-
mode
: The mode for this view model is"filter"
. You cannot use query tokens in this format string.
-