Skip to content

Field_Map

See Also: DF_Field_Number attribute, Get_FieldNumber, Get_FileNumber

Purpose

To return the field number of a given field of a database file.

Syntax

Field_Map {file-handle} {field-name} To {field-number}

Where {file-handle} is a handle to the file containing the field; {field-name} is the name of the field; and {field-number} is the name of a variable that will receive the field number.

What It Does

The Field_Map command determines the field number of a field of a database file. This command is useful when you have the name of a field, but not its number. The field number is especially useful for getting information about the field.

Example

Integer iField   // The field number.
Integer hFile    // The file.
Integer iType    // The type of field. See Get_Attribute.
Integer iLength  // The field length.

// To find Vendor, it must be in your workspace DFPath.
Open "Vendor" As hFile
Field_Map hFile "Name" To iField

// Get the field's metadata.
Get_Attribute DF_FIELD_TYPE of hFile iField To iType
Get_Attribute DF_FIELD_LENGTH of hFile iField To iLength

// Show the information about the file.
Showln "Field Type of Name is " iType
Showln "Field Length of Name is " iLength

// Close the file.
Close Vendor

Notes

  • If {field-name} is not found in {file-handle}, you will receive Error 4100: Cannot find field.