SetFieldDecimals()

Summary

Changes the number of displayed decimals for a real-typed field.

Syntax

SetFieldDecimals(string field_spec, integer new_decimals)

Argument Contents
field_spec A field spec
new_decimals The new number of displayed decimal places

Notes

  • The number of displayed decimal places is used when the field is displayed in an editor. It is also used when the field is exported (see ExportView()).

  • The change in the number of displayed decimal places 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 number of displayed decimal places is not necessarily equal to the actual number of decimal places in the data file, and the SetFieldDecimals() function does not affect any underlying data file in any way. To change the number of decimal places in a data file, use the ModifyTable() function.

Example

curr_dec = GetFieldDecimals("States.PopDensity")
SetFieldDecimals("States.PopDensity", curr_dec + 2)

Error Codes

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

See Also

Function Summary
GetFieldDecimals() Returns the number of displayed decimal places for a real-typed 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