Xbasic

FIELD.DEC_GET Function

Syntax

Decimal_Width as N = Dec_Get()

Description

Gets the fields' number of decimal places.

Discussion

The .DEC_GET() method returns the Decimal_Width of the specified numeric field. The field can be specified either by using the field object pointer, or by a table object pointer and a field name. The Decimal_Width is the number of decimal places the number can contain.

Example

Display the table structure in the Trace window.

dim tbl as P
dim fld as P
tbl = table.current()
for i = 1 TO tbl.fields_get()
    fld = tbl.field_get(i)
    f_name = fld.name_get()
    f_type = fld.type_get()
    f_width = ltrim( str( fld.width_get() ) )
    f_dec = ltrim( str( fld.dec_get() ) )
    trace.writeln( "Field " + ltrim(str(i) ) ) 
    trace.writeln("Field Name: " + f_name)
    trace.writeln("Field Type: " + f_type)
    trace.writeln("Field Width: " + f_width)
    trace.writeln("Field Dec: " + f_dec)
next

See Also