SetFieldWidth()

Summary

Changes the display width of a field.

Syntax

SetFieldWidth(string field_spec, integer new_width)

Argument Contents
field_spec A field spec
new_width The new display width for the input field.

Notes

  • The display width is used as the width of the field when it is displayed in an editor. It is also the width of the field when it is exported (see ExportView()).

  • The change in display width is propagated 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.

  • The display width is not necessarily equal to the actual width (number of characters) of the field in the data file, and the SetFieldWidth() function does not affect any underlying data file in any way. To change the actual width in a data file, use the ModifyTable() function.

Example

curr_width = GetFieldWidth("States.Population")
SetFieldWidth("States.Population", curr_width + 2)

Error Codes

Error Type Meaning
NotFound The input field does not exist or the field specification is ambiguous

See Also

Function Summary
GetFieldWidth() Gets the display width of a field
GetFieldInfo() Returns the data type, display width, decimals, and index flag for a field
ModifyTable() Modifies the file structure of a dBASE, fixed-format text or fixed-format binary table