SetFormatNumber Method for LCField

This method assigns the current format setting for a number field. Calling this method clears all values for this field.

Defined In

LCField

Syntax

Call thisField.SetFormatNumber (numberFlags, size, precision, scale)

Parameters

Parameter

Description

numberFlags

Long. Optional. Number flags assigned to the number field. Refer to the Field Number Format section for a description of the flags. The default is 0.

size

Long. Optional, >= 0. Size in bytes assigned to the number field. Zero indicates the size of the corresponding number object (LONG, DOUBLE, LCCURRENCY, or LCNUMERIC). The default is 0. The size setting doesn't affect the behavior of the field within your program; it is only relevant when interacting with an external system.

precision

Long. Optional, >= 0. Precision assigned to the number field. Zero indicates not used for this field. The default is LCMAX_NUMERIC_PREC.

scale

Long. Optional, >= 0. Scale assigned to the number field. Zero indicates not used for this field. Since zero is also a valid scale value, a constant LCSCALE_ZERO is defined which can be used to indicate a zero scale. The default is LCMAX_NUMERIC_PREC / 2.

Usage Notes®

"Precision" refers to the total number of digits that may be stored in the field. "Scale" refers to the number of digits precision to store after the decimal point.

The size, precision, and scale values are ignored with the LCTYPE_FLOAT and LCTYPE_INT types. These are system data types, whose operation is not customizable.

Example

Option Public
Uselsx "*lsxlc"  
Sub Initialize
  Dim field As New LCField (LCTYPE_NUMERIC)
  Dim flags As Long
  Call field.SetFormatNumber (LCNUMBERF_UNSIGNED, , 10, 4)
  Call field.SetFloat(3045.093657)
  Call field.GetFormatNumber (flags)
  Print "The number flag setting is " & Hex(flags) & "h."
  Print "Value = " & field.Text(0)
End Sub

Example Output

The number flag setting is 1h.
Value = 3045.0936