Skip to content

Fill_Field

Purpose

To seed a record buffer with the highest (maximum) or lowest (minimum) value for the field's data type.

Syntax

Fill_Field {table-handle} {field-number} With {DF_LOW | DF_HIGH}

Where {table-handle} is a handle to the database table, and {field-number} is the number of the field which is to be filled.

Supported by

  • DF_DATETIME type: The DataFlex SQL Drivers (SQL Server, DB2, and ODBC), revision 5.0 and higher.
  • All other types: All Drivers.

What It Does

The Fill_Field command places either a maximum or a minimum value in the field {field-number}. When DF_LOW is specified, minimum values are placed in the field. The DF_HIGH value places a maximum value in the field.

Other databases may have maximum and minimum values that are different from those of the DataFlex database. Seeding the search field in the buffer with DF_HIGH or DF_LOW will prevent data errors of the kind that arise when DataFlex encounters data values that are otherwise invalid. DF_HIGH and DF_LOW use the length of the field to create maximum and minimum values for numbers and strings.

For example, Fill_Field will set a numeric field with length 6 to 999999 if DF_HIGH is specified. For DF_LOW, the value set is 99999. Note that DataFlex tables will "lose" a digit for the minimum—the maximum has six digits, while the minimum has only five.

Example

The following is a small procedure that sets field 2 of a table to maximum value and field 3 to a minimum value.

Procedure DoResetForFind Integer hTable
    Fill_Field hTable 2 With DF_HIGH
    Fill_Field hTable 3 With DF_LOW
End_Procedure

Notes

  • The record that has been filled using this command will be first (if the DF_LOW parameter is used) or last (using DF_HIGH) when ordering by this field.

  • Regardless of the native database type, if data is read from a field that was written using the Fill_Field command, the data returned will be the highest or lowest value, in DataFlex format, supported by that field.

  • If a record is saved that has fields that were written using the Fill_Field command, the data written is the highest or lowest value supported by that field.

  • For DF_BINARY, DF_TEXT, DF_ASCII, and DF_OVERLAP, minimum values are null bytes.

  • For DF_BINARY and DF_OVERLAP, the maximum values are 0xff Hex.

  • For DF_ASCII and DF_OVERLAP, the maximum values are strings filled with the highest character of the collating sequence. When using the MS SQL Driver, the DF_HIGH character is determined by the collating sequence on SQL Server.

  • For DF_NUMBER and DF_DATE, the maximum value is all 9s for as many digits that the field occupies. That is, an 8-digit field will have a maximum value of 99999999.

  • For DF_NUMBER and DF_DATE, the minimum value is all 9s for as many digits the field occupies minus one. Thus, an 8-digit field will have a minimum value of –9999999 (note: only 7 digits!).

  • For DF_DATETIME, the minimum and maximum values depend on the database back-end.

  • For field 0, Recnum, the minimum value is zero.