JoinTableToLayer()

Summary

Permanently joins a single table to a geographic file.

Syntax

JoinTableToLayer(string database, string layer, string class, string primary, string secondary, string field, array options)

Argument Contents
database The path and file name of the database
layer The name of the layer
class The class of the table (FFB, FFA, CSV, DBASE)
primary The primary filename of the table
secondary The secondary filename of the table
field The field in the table used for linking
Option Type Contents
Hide ID Boolean "True" to hide the ID field in the database, or "False" (the default) if the ID field should be displayed.
Hide Link Boolean "True" to hide the link field in the table, or "False" (the default) if the link field should be displayed.
Symmetric Boolean "True" if the table and the layer contain exactly the same records; i.e., each record in the layer has a corresponding record in the table, and each record in the table has a corresponding record in the layer. "False" (the default) otherwise.
Ordinal Boolean "True" if the n-th geographic record matches the n-th table record; "False" (the default) otherwise. Ordinal implies Symmetric. If you specify Ordinal, you do not need to specify Symmetric.

Notes

  • The file types include FFA for fixed-format text (ASCII), FFB for fixed-format binary, and CSV for comma-separated text (values).

  • The ID field of the database (geographic file) is used to create the left side of the join.

  • For Compact Geographic files, the Hide ID and Hide Link options are mutually exclusive.

  • For Standard Geographic files, the Hide ID option and the Ordinal option are not supported.

  • If the table's secondary filename has the same name as its primary filename and uses the default extension for the table's class, then it may be passed as null.

  • If the path to the primary filename matches the path to the database, then the primary filename is recorded with no path. In this case, Maptitude attempts to open the table in the same directory as the geographic file, allowing the table files to be moved with the geographic files to a new directory. Otherwise, the primary filename is recorded with the specified path, and Maptitude attempts to open the table in that location regardless of the location of the geographic file.

  • JoinTableToLayer() does not verify the supplied information. It does not check that the table exists, or contains the specified field. Maptitude attempts to establish the specified join when the geographic database is opened. At that time, if the table does not exist, or does not contain the specified field, then the join fails and the geographic file opens without the table.

  • If the Symmetric option is specified, then the resulting join takes advantage of any permanent indices that exist in the table. Otherwise, these indices are ignored.

  • If the Ordinal option is specified, the field parameter is ignored and may be passed as null.

  • The Ordinal option is used only for compact (.CDF) geography file. It will be ignored if the table is being joined to a standard (.DBD) geography file.

Example

folder = RunMacro("G30 Tutorial Folder")
JoinTableToLayer(folder + "cthwy.cdf", "Highways", "FFB", folder + "cthwy.bin", , "ID", {{"Hide Link", "True"}})

Error Codes

Error Type Meaning
NotFound The specified geographic file does not exist
Error The specified geographic file is read-only

See Also

Function Summary
JoinViews() Creates a joined view by linking fields in two existing views