In this example, we are looking for a Boolean field within our table. For simplicity's sake, let's assume that we are working with Table One.
C_LONGINT($File;$ErrCode;$Field)
ARRAY LONGINT(aTypes;0) `
field types
ARRAY LONGINT(aLength;0) `
field length (for alpha fields)
ARRAY LONGINT(aIndexes;0) `
indexed?
ARRAY LONGINT(aInvisible;0) `
invisible?
ARRAY STRING(15;aNames;0) `
field names
$File:=1 `
get information on file 1
$ErrCode:=OP Get field properties (vl_ConnectID;$File;$Invisible;aNames;aTypes;aLength;aIndexes;aInvisible)
For ($i;1;Size of Array(aTypes))
If (aTypes{$i}=6)
$Field:=$i 'fields are listed in order
end if
end for
Notice we are using a Longint array for aTypes. We could also make this into a string, text, real, or integer array. This command will return values depending on the type passed. For our Boolean example, our Longint array will return a 6 for Boolean, where as a string array would return a value of 'Boolean.'
Also, since the fields are returned in the order they appear in the structure, all we need to do is return the loop count which will be equivalent to the field number.