Attribute Queries

Attribute queries are used to find and select elements of a map layer using their attribute values or a database associated with the layer. In JMap Admin, JMap administrators create the queries and their associated forms. Then, users of JMap applications use those forms to enter attribute values to search for. All elements whose attribute values match the values entered are then selected or listed in an elements explorer.

You can access the query configuration section by clicking on Queries in the Projects section.

Creating a new attribute query

To create a new query, press the Create query button in the Attribute queries section. This will open the query configuration interface. Parameters will vary depending on the type of query selected.

Layer queries

External queries

This type of query is used when the search must be conducted within the data of an external database. The external database must contain a field that links to a layer attribute. A select SQL query is executed in the external database and the values returned are then associated with the layer elements using the link field.

Required and optional parameters

Although search forms are designed to mark fields as required or optional, the where clause of the query must be adjusted to support this option. To accomplish this, any part of the query that is associated with optional parameters must be included between braces ( { } ).

Example of WHERE clause:

CITY = '$param1' and { COUNTRY = '$param2' }

This example searches for cities for which the attribute value CITY is equal to the value of parameter 1 ($param1) entered by the user and who optionally have their value for the COUNTRY attribute equal to the value of parameter 2 ($param2) entered by the user. If parameter 2 is left blank , the entire block { COUNTRY = '$param2' } is removed from the query, along with the and operator, which is now an orphan. Note that the administrator must absolutely define $param2 as optional when designing the form. Refer to the Forms section for more information on designing forms.

Multiple values for the same parameter

Multiple values can be entered with a List (multiple choices) type field in the forms. The values are separated by the delimiter character ; (semicolon). This option can be activated in the WHERE clause of the query. The syntax is as follows:

$multiple{true|false} {$delimiter{;}}

Example:

CITY = '$param1{$multiple{true} $delimiter{;}}'

Searches for cities whose CITY attribute value is equal to one of the values entered in parameter 1. The values are separated by semicolons.

Managing attribute queries

Attribute queries can be modified by administrators. In JMap Dakar and later versions, when a project’s queries are modified, the applications that disseminate the project do not need to be redeployed because the changes are reflected directly.

Organizing attribute queries

Attribute queries can be organized into groups.This is particularly useful for projects that have a large number of queries.

Deleting attribute queries

Deleting an attribute query permanently deletes the query and its associated form. To delete a query, select it in the list and click on Delete.

Publishing queries

Once a query has been created, it is automatically published. However, you can disable this publication, which will make your query unavailable in applications, but its configuration will still be saved. If you do not want your query to be published, clear the Published checkbox of your query in the query management interface.

Queries on referenced layers

When a project contains referenced layers, the queries configured on these layers are automatically available in the project. The project “inherits” these queries.

You cannot modify these queries from the project; they can only be modified in the project that contains the original layer.

If you wish to make changes to a query on a referenced layer, create a copy of the query by clicking on Clone. The configuration interface shows the search parameters that you can modify.

Once the new query has been configured, you can clear the Published check box of the query that was “inherited” from the referenced layer if you no longer want it to be available in JMap applications. If the Published check box is cleared for an attribute query on a layer, that query will no longer be available in the projects that use the referenced layer.

You can also create a new query on a referenced layer as described in the section Creating a new attribute query.

Dernière mise à jour

K2 Geospatial 2022