GetFields()

Summary

Gets a list of the fields in a view.

Syntax

fields_array = GetFields(string view_name, string field_type)

Argument Contents
view_name The input view; or null for the current view
field_type The string "All" to return a list of all fields in the view; the string "String" to return a list of string-typed fields, the string "Numeric" to return a list of all integer- and real-typed fields, or the string "Integer", "Real", "Long", "Short", "Float", "Double" or "ABBA" to get a particular type of numeric field

Returns

An array of two (2) elements:

Element Type Contents
1 Array An array of field names (strings)
2 Array An array of field specs (strings)

Notes

  • The field_type value of Integer means Short or Long, and Real means Float or Double.

  • The field_type value of ABBA returns a list of "dual fields," i.e. fields which have the same type and matching name, except one has "ab" replaced with "ba". For example, fields "AB_Flow" and "BA_Flow" which are candidate fields for a dual sized theme on a line layer. With this field type, the function returns an even number of field names, with matching AB/BA fields in pairs.

  • Typically, the array of field names is used to present to the user, e.g., in a popdown list. The array of field specs is then used in calling other functions, e.g., GetFieldWidth(), which require a field spec instead of just a field name.

  • GetFields() returns null if the view does not exist, if view_name is null and there is no current view, if the view has no fields of the specified type, or if the field_type is not recognized.

Example

tmp = GetFields("U.S. States", "All")
fld_names = tmp[1]
fld_specs = tmp[2]

See Also

Function Summary
GetField() Returns the view, field name, and field spec for a field
GetEditableFields() Gets a list of the editable fields in a view
GetFieldFullSpec() Returns a full field spec for a field name
GetReadOnlyFields() Gets a list of the read-only fields in a view
GetMappableFields() Creates a list of the fields that are mappable to a layer
GetIDField() Gets the full field spec of the ID field for a layer