A General Query is used to find and return data from one or more data fields in one or more linked tables based on a set of conditions. You can view the tabulated results of the query in the Query Results viewer, and also use general queries as sources of data in many modules in HGA, such as plot data in a Well Profile, thematic data in a Map, source data for a contour map or plume in a 3D Scene, or source data for one or more plots in a Plot Collection.
The following provides an example of creating a General Query with guided steps using the Demo Project.
If the Query Builder tab is not yet opened, select the Query Builder icon from the main toolbar.
In the Query Builder tab toolbar, select the New button , and the following dialog will appear:
•Select a Query Type: Note the default Query Type is the Standard Select Query - which is the query type for this example, so we do not need make a change.
•Provide a Query Name: Station with TOC exceeding 320masl (for this example)
We also have the option to specify the location of the Query. By default, new queries will be stored in the root of the Queries branch of the Project tree; however, you can create folders to organize your queries and select the folder where you wish to save your query. For this example, we we will leave the default which will save the query to the main Queries branch (i.e. not in a folder).
•Select OK to create the query.
By default, the only field selected to be displayed in the query is the Station Name. We are going to add other fields to the display fields. Let's select the Map, Plot and Plume Ready options as well as the Well Profile option - this will automatically add several fields to the Display Fields section and will make the query available in other modules within HGA.
•Expand the tree in the Available Fields section to find the TOC field (under the Description category and the Location table.
•Double-click on the TOC field - notice it has been added to the Display Fields section.
Let's add a condition to the Query:
•Click once on the TOC field (it will become highlighted blue), and drag this field into the blank Conditions field (under the Expression column). The TOC field will be added to the Query Conditions. (Alternately, you may use the (Add) button (on the bottom half of the conditions section) to add conditions, then define them manually).
•We need to set an operator and value for our Condition. You will notice there are several options in the Operator drop down list (>, >=, <, <=, =, <>, IS, IS NOT, and LIKE) providing you several options to query your data from the database.
•Select the > option from the drop down list in the Operator column.
•Enter the number 320 in the Value field.
•In the Conditions section, select the Source Conditions. The options are Project, Station Group, and Database. If Station Group is selected, then another combo box will become activated where you can select the appropriate Station Group to be the source for this query. If Project is selected, then all stations in the project will be queried. If Database is selected, then the query will be applied to the entire database. For this example we will use the default - Project.
•The Query Builder should look similar to the image below:
•Select the Execute Query button and you will be moved to the Query Results tab to see the results of your query.
The new data query will now appear as a new branch under the Queries node in the Project Tree - if you do not see it right away right-click on the Queries branch and select Refresh.
This query can be executed/run at any time by selecting it from the Project Tree. The results will show on the Data Query tab.
If you need to make further changes to the query right click on the query in the Project Tree and select Edit Query... and the query will be opened in the Query Builder tab.
For further information on what can be done with the query once it has been executed and the results are being displayed - please see the section on the Query Results section.