Configuring a User Query
A User Query is an SQL query used to retrieve data from the ClearSCADA database for analysis purposes or to display on a map.
For example, you can use a User Query to display:
- Overall system Key Performance Indicators (KPIs) for management
- Production summaries
- System water flows
- Reservoir levels
- The location of outstations on a map.
A User Query is represented in the ClearSCADA database by a User Query database item, which you can create as follows:
- Display the Database Bar (see Display an Explorer Bar).
- In the Database Bar, right-click on the Group, Group Template, or system that is to contain the new User Query.
A context sensitive menu is displayed. - Select the Create New option.
A further menu is displayed. - Select the Other option.
A further menu is displayed. - Select the User Query option.
ClearSCADA adds a new User Query database item to the Database Bar and selects it automatically, ready for you to enter its name.
- Type a suitable name, then press the Enter key to confirm (or select another part of the ViewX interface).
The next step is to configure the User Query database item. To do this, right-click on the item to display its Object Menu then select the Edit Properties option.
ClearSCADA will then display the User Queries form.
This section describes the settings on the Query tab of the User Queries form.
You can find details of the settings on the other tabs as follows:
- Identification—Use to optionally define a Help View and to indicate whether the item is to be excluded from any Exclusive Control activity (see Defining Identification Details).
- Location—Use to define the default location on which the User Query data will be displayed. For more information, see Use the Location Tab to Specify an Item's Geographic Coordinates.
- User Methods—Use to define any custom pick actions (‘methods’) for the item (see Using the User Methods Tab to Define Custom Actions).
Configure the fields on the Query tab as follows:
- Display Name—Enter a name that will uniquely identify this User Query in ClearSCADA.
- Description—Enter a description for the User Query.
- SQL Query—Enter the SQL query that you want ClearSCADA to perform.
You do not need to add a semicolon to the end of the SQL Query.
ClearSCADA will truncate queries at 500 rows, so it is advisable to use the "TOP" and "ORDER BY" syntax to restrict the number of rows returned.
- Display by default on Map Set—Select this check box if you want ClearSCADA to display the User Query by default when it displays a Map Set that this User Query is associated with. Clear this check box if you do not want ClearSCADA to display the User Query by default. For more about associating a User Query with a Map Set, see Associating User Queries with a Map Set in the ClearSCADA Guide to Mapping and Geographic Information.
When you have finished, save the configuration (see Saving Configuration Changes).