Xbasic
FIELD.TYPE_GET Function
Syntax
C Type_Get()
Description
The .TYPE_GET() method returns the Field_Type of a field referenced by the object pointer. The result is a character code representing one of the following field types:
- Field Type
- Type Code
- Character
"C"
- Numeric
"N"
- Date
"D"
- Logical
"L"
- Memo
"M"
- Rich text memo
"RTF"
- Bitmap
"B"
- OLE
"O"
You can use the .TYPE_GET() method together with the <FIELD>.VALUE_GET() method when obtaining a field value.
Example
This script prints the contents of each record in the Trace window. The data type returned by the .VALUE_GET() method is determined by the field type.
dim tbl as P dim fld as P tbl = table.current() number_of_fields = tbl.fields_get() tbl.fetch_first() while .NOT. tbl.fetch_eof() for i = 1 TO number_of_fields fld = tbl.field_get(i) field_type = fld.type_get() select case field_type = "N" trace.writeln( str( fld.value_get() ) ) case field_type = "D" trace.writeln( dtoc( fld.value_get() ) ) case field_type = "L" trace.writeln( iif(fld.value_get(), "T","F") ) case else trace.writeln( fld.value_get() ) end select next i trace.writeln("----------------------------") tbl.fetch_next() end while
See Also