GetTableStructure()

Summary

Gets a list and description of the fields in a table.

Changes

In Version 2013 added field types "Date", "Time", and "DateTime." In Version 2014 added optional option "Include Original."

Syntax

field_info = GetTableStructure(string view_name, opt array options)

Argument Contents
view_name Name of a view containing the table
Option Type Contents
Include Original Boolean if "True," instead of returning 11-element arrays, each element with have 12 elements, the 12th one being a duplicate of the first one

Returns

An array with one element for each field in the table. Each element is an array with the following structure:

Element Type Contents
1 String Field name
2 String Field type: "Integer", "Real", "String", "Short", "Tiny", "Float", "Date", "Time", or "DateTime"
3 Integer Number of characters (bytes) per record for this field in the file, i.e., the internal field width
4 Integer Number of decimals
5 Boolean A flag ("True" or "False") that indicates whether the field is internally (permanently) indexed
6 String The default display format for the field values
7 Array A list of aggregation rules for the field
8 String A description of the field
9 Same as field type The default value
10 Array Aggregation rules when joining/splitting features for geographic editing
11 String The display name
12 String Field name (if "Include Original" option is used)

Notes

  • The options array is an optional argument.

  • All returned values describe the underlying table, not the view of the table. To determine the values for the view, use GetViewStructure() instead.

  • The types Short and Tiny are two- and one-byte integers, respectively, but Integer refers to a four-byte integer. Similarly, Float is a four-byte real number, while Real is an eight-byte real number.

  • For a fixed-format binary table, the type (e.g., Real versus Float) represents the field storage width, while the field display width and number of decimals (elements 3 and 4) represent the default display settings.

  • Functions such as RenameField() and SetFieldWidth(), which affect the view, do not affect the result of GetTableStructure().

  • Expression fields in the view are ignored.

  • If the input view_name is null, GetTableStructure() uses the current view.

  • The array returned by GetTableStructure() can be used to formulate inputs to ModifyTable().

Error Codes

Error Type Meaning
Error The input view is not a table (e.g., it is a joined view)
NotFound The named table does not exist, or table_name is null and there is no current view

See Also

Function Summary
GetFieldTableType() Gets the data type of a field in tables and joined views
GetViewStructure() Describes characteristics of all the fields (including expression fields) in a view
ModifyTable() Modifies the file structure of a dBASE, fixed-format text or fixed-format binary table