Exploring Your Database

Query Explorer

Table of Content

Table of Content

Table of Content

The Database Explorer window can also be used to display your existing queries, saved-results and saved-charts. This can be done by clicking on the Queries button in the toolbar (or View > Queries).

A window such as the following is displayed:


Query Directory

This display shows the queries and saved-results within your Query directory. The Query directory is the default location for saved queries, and is set with Options > File Locations. Queries not within this directory structure will not be shown on this display.

Window Layout

The Query explorer has the following layout.

  • the left panel gives you the sub-directories within your Query directory.

  • the middle pane shows you the queries, saved-results and saved-charts within the directory selected in the left panel.

  • the right panel shows your query text, query contents (right-click the query to select this) or chart details.

The Query Explorer will show you Queries (which have a file type of sql), Saved-Results (which have a file type of grd) or Saved-Charts (which have a file type of xcf). Files with other suffixes (ddl, txt etc) are not shown.

The drop-down list above the query-list allows you to select which types of files you wish to see.

What you can do

After selecting a query or saved-result:

  • click on the Display button to display the data

  • click on the Run SQL button to edit the SQL text in the Run SQL window

  • click on the Query Builder button to edit the query in the Query Builder window

  • click on the Export button to Export the data

  • the buttons at the top of the middle-panel allow you to edit / rename or delete files

After selecting a saved-chart, you can right-click the chart for options. This will include:

  • Refresh. This will refresh the chart with current data. AQT will rerun the query which provides the data for the chart; you need to be signed onto the database this query uses in order to refresh the chart.

  • Save. If you have refreshed the chart, you can update the saved-chart with the current version of the chart.

  • Save as. This allows you to save the chart with as a different file name. Note that you will not see this new file in the list-of-queries until you hit the Refresh button or hit F5.

  • View / Edit chart in Chart window. This opens the chart in the Chart window. This allows you to manipulate or alter the chart.

  • Print, Export. The options allow you to export or print the chart.

Notes

  • This window displays all queries, irrespective of which database they were run against. If you try to display a query when you are connected to a different database, it may not run successfully.

  • You cannot Display or Export a query that contains action SQL (such as Inserts, Updates etc). To run these, click on the Run SQL button then run them from there.

Using Shared Queries

In addition to your personal queries, you can have Shared Queries. These are queries that would be shared amongst the members of your work group.

To specify Shared Queries, in Options > File Locations > Location of Shared Queries - specify a directory which is accessible to the members of your workgroup. An example would be a directory on a shared server.

Once you have done this, the Queries display in the Database Explorer will show you both Personal Queries and Shared Queries.


Amending Shared Queries

By default, you won't be able to amend any Shared Queries, or add new ones.

If you need to do this, go to Options > User Rights and select Allow Changes to Shared Queries > Warn or Yes. If you change this option, it is recommended that you only do so for a short time to perform a particular task. It should not be selected for a long period of time as this might result in inadvertent changes to shared queries.

System administrators may wish to lock this setting to prevent unauthorised users from changing it.

File Open / Save window

The Open / Save window now has two buttons - Home and Shared Home

  • Home will take you to your Personal Queries directory

  • Shared Home will take you to your Shared Queries directory

You can open files in either directory, but can only save files in the Shared directory if authorized to do so.

Copying a Personal Query to a Shared Query

Once you have developed a query as a personal query, you may then wish to move this to the Shared query folders.

You can do so by:

  • right-clicking the file and selecting Administer > Move/Copy

  • clicking on the Move icon in the admin toolbar

  • you can then specify the directory the file is to be moved or copied to