beautypg.com

Using templates for queries, Deriving columns – Pitney Bowes MapInfo Professional User Manual

Page 250

background image

When you save a MapInfo table to dBase format, the .tab file maintains the Time and DateTime types
so that when you reopen it the data displays as either Time or DateTime. If you attempt to open these
.tab files using a non-MapInfo application, these fields display as character fields.

The Help System contains these related topics:

Time and DateTime Data Type Support for Remote Databases

Interpreting ASCII and CSV Data

Using Templates for Queries

Query templates enable you to save Select or SQL Select statements as templates and reload them.
This saves you the trouble of having to rebuild a query each time you want to use it. Both the Select
and SQL Select dialog boxes have Load Template and Save Template options to enable you to do this
easily. Query templates are useful for re-creating a query with an updated version of the table used in
the original query, or for executing a query on a table that has the same fields as the table on which the
query statement was created.

Loading a Template

You can load any saved query template.

To load a query template:

1. In the Select or SQL Select dialog boxes, lick the Load Template button. The Load Dialog From

Query File dialog box displays. It lists the .QRY files.

2. Select the .QRY file you want to use, and click Open. The Select or SQL Select dialog box displays

with the values from the template already filled in. Simply execute your query to create the query
browser.

Renaming a Template

Rename a template by selecting and clicking the template name; enter a new name up to 64 characters.

Saving a Template

After you have finished writing your Select or SQL Select query, you can save the query as a template.

To save a query as a template:

1. In the Select or SQL Select dialog boxes, click the Save Template button to save the query to a

template, or query file. The Save Dialog to Query File dialog box displays.

2. Give the query file a name, select a folder, and click Save. Query files are saved with a .QRY extension

and are saved in the directory specified in the Directories preferences.

The query does not need to be complete or syntactically correct to save it to a template.

Note:

Deleting a Template

To delete a template:

• Select the template name and press the Delete key. A dialog box displays prompting you to confirm

or cancel the operation. If no templates of the given type exist, a button to restore a default template
displays.

Deriving Columns

A derived column is a column in a query table whose contents are created by applying an expression
to the values of columns already existing in some base table. In the example above, population density
was a derived column. By default, the Select Columns box contains an asterisk (*), indicating that all
of the columns in the base table are to be included in the query table. If you do not want all of those
columns, you should delete the asterisk and list only those columns that you want to use. You are not

MapInfo Professional 12.5

250

Querying Your Data in MapInfo Professional