GetMappableFields()
Summary
Creates a list of the fields that are mappable to a layer.
Syntax
fields_array = GetMappableFields(string layer_name, string field_type)
| Argument | Contents |
|---|---|
| layer_name | The input layer; or null for the current layer. |
| 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 "ABBA"to return a list of "dual fields. |
Returns
An array of two (2) elements:
| Element | Type | Contents |
|---|---|---|
| 1 | Array | An array of mappable field names (strings). |
| 2 | Array | An array of field specs (strings). |
Notes
-
A mappable field is any field that is on the base layer view or on a joined view that is mappable to the layer.
-
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.
-
The arrays returned by GetMappableFields() do not contain repeated fields -- in particular, a field on the layer base view has a counterpart in any mappable joined view. GetMappableFields() returns only the field on the base view, and not its counterpart in the joined view.
-
Typically, the array of mappable 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.
-
GetMappableFields() returns null if the layer does not exist, if layer_name is null and there is no current layer, if the layer has no mappable fields of the specified type, or if the field_type is not recognized.
Example
tmp = GetMappableFields("U.S. States", "All")
fld_names = tmp[1]
fld_specs = tmp[2]
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The input layer is not geographic, e.g., it is an image layer. |
See Also
| Function | Summary |
|---|---|
| GetField() | Returns the view, field name, and field spec for a field |
| GetFieldFullSpec() | Returns a full field spec for a field name |
| GetFields() | Gets a list of the fields in a view |
| GetMappableFieldIndices() | Determines the positions of mappable fields in the arrays returned byGetMappableFields() |