RenameField()

Summary

Renames a field in a view.

Syntax

RenameField(string field_spec, string new_name)

Argument Contents
field_spec A field spec
new_name The new name for this field

Notes

  • The RenameField() function does not change any underlying data file in any way. It only changes the field's name in the view. To change the underlying data file, use ModifyTable().

  • RenameField() propagates the name change to all joined views containing this field. If the input field itself belongs to a joined view, the change is also propagated to any underlying base views.

  • Use RenameField() to make field names more readable.

Example

RenameField("Employee.IDcd", "ID Code")

Error Codes

Error Type Meaning
NotFound The input field does not exist or the field specification is ambiguous
Error The input new_name is not valid, e.g., it contains unbalanced square bracket characters

See Also

Function Summary
GetFields() Gets a list of the fields in a view
GetMappableFields() Creates a list of the fields that are mappable to a layer
ModifyTable() Modifies the file structure of a dBASE, fixed-format text or fixed-format binary table