From a query

About this task

When generating a type tree from a query, information is used from your database and from the Database Interface Designer to create the type tree. If you change the definition of your query in the Database Interface Designer or edit that database definition, you must generate a new type tree to reflect the new information.

When attempting to generate a type tree, if your query is incorrectly specified, an error message from your database is received and a message displays, indicating that the column definitions for that query could not be accessed. In this scenario, a type tree is not generated.

Generating a type tree provides a way to test the syntax of your select statement. If you can successfully generate a type tree from a query, you know that the query has valid syntax.

An example of the Generate Type Trees From Query dialog follows, along with a table describing its fields and their descriptions.

Field Description
File name This field displays a system-generated file name based upon the database selection in the Navigator. The default value is the database name with a type tree extension (.mtt) and a default path.

To change any of this information, click the browse button.

Overwrite file This check box determines whether you want to replace the existing type tree file (MTT) upon saving it. The default value is disabled.
Override type This check box determines whether to replace existing types with matching, newly generated types and to add any non-matching new types to the type tree file (MTT). This is useful when you want to add types for additional stored procedures into an existing type tree. The default value is enabled.
Row group format This list displays options to determine the row format in the generated type tree. The default value is Delimited.
Delimited Select this option to create rows delimited with a pipe character (|) or some other user-defined selection. This is the preferred option if you are using large column widths where the values may be smaller than the width of the columns. The pipe character is the default selection.
Fixed Select this option to create rows of fixed size in the generated type tree. There are certain situations in which you would want to select Fixed.
  • The query result contains a large number of rows where each row consists of small, fixed-length fields. In this situation, delimiters are unnecessary and they also consume memory.
  • You need to append fields in the output. This may be true if multiple fields have some meaning when concatenated together.
Delimiter This is the value for the delimiter to be used when generating this type tree. For a list of available symbols, click the browse button. The Symbols dialog appears, allowing you to select the desired value. The default value is a pipe character (|).
Terminator This is the value for the terminator to be used when generating this type tree. For a list of available symbols, click the browse button. The Symbols dialog appears, allowing you to select the desired value. The default value is <CR><LF >.
Release This is the value for the release character to be used when generating this type tree. For a list of available symbols, click the browse button. The Symbols dialog appears, allowing you to select the desired value. The default value is an exclamation point (!).
Override Column Definitions (For ODBC only) This check box indicates whether the database driver (with the check box disabled) or a command line override (with the check box enabled) is used to interpret columns. The default value is disabled.

For more information about this field, see the adapter-specific documentation in each adapter reference guide.

Generate type trees in 1.4.0 format (For Oracle adapter only) This check box determines whether you can generate type trees that are compatible with Version 1.4.0 maps. You might enable this functionality if you have legacy 1.4.0 maps that you want to maintain for some reason. The default value is disabled.

For more information about this field, refer to adapter-specific documentation in each adapter reference guide.

Represent date/time columns as text items If you enable this check box (generating date and time as a text string), you may have to use either the TEXTTODATE or TEXTTOTIME function in a map rule to convert the text string to the database-specific date and time format.
If you are generating new type trees, make sure this check box is disabled. The default is disabled.
Note: Because of adapter-specific differences in date and time formats, see the adapter-specific instructions in each adapter reference guide.
Treat text item as This list displays the languages available in which to handle text items. The default value is Western.

To generate a type tree from a query:

Procedure

  1. In the Navigator, highlight the icon of the query from which you want to generate a type tree.
  2. From the Query menu, select Generate Tree.

    or

    In the Navigator, right-click the query and select Generate Tree.

    The Generate Type Tree from Query dialog appears, displaying the name of the selected type tree.
  3. To create a new type tree, in the File name field, specify the path and name (with an .mtt extension).

    or

    Click the browse button to select a type tree from the Save As dialog. Highlight it and click OK.

  4. Specify the remaining options as desired. Refer to context-sensitive help for field-specific information.
  5. Click OK.
    The Database Interface Designer and the Type Tree Maker produce a type tree corresponding to the selected database query.

Results

The generated type tree is represented in the Navigator with the query icon displayed next to the name.