GetViewStructure()

Summary

Retrieves a listing and description of the fields in a view.

Changes

In Version 2013 added field types "Date", "Time", and "DateTime."

Syntax

field_info = GetViewStructure(string view_name)

Argument Contents
view_name Name of a view

Returns

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

Element Type Contents
1 String Field name
2 String Field type: "String", "Integer", "Real", "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

Notes

  • All returned values describe the view, not the underlying table. As a result, functions such as RenameField() and SetFieldWidth() affect the returned values. To determine the structure of a table, use GetTableStructure() instead.

  • The returned array includes expression fields in the view.

  • GetViewStructure() can be used on joined views.

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

  • GetViewStructure() returns a field_info_array that can be used as an input to the CreateTable() function to create a new (empty) table with the same field characteristics.

Error Codes

Error Type Meaning
NotFound The named view does not exist, or view_name is null and there is no current view

See Also

Function Summary
GetTableStructure() Gets a list and description of the fields in a table
CreateTable() Creates an empty table and opens it as a view
RenameField() Renames a field in a view
SetFieldWidth() Changes the display width of a field
SetFieldDecimals() Changes the number of displayed decimals for a real-typed field