version 1.5
OP Get field properties (connectionID; tableID; tableInvisible; fieldNames; fieldTypes; fieldLengths; fieldIndexed; fieldInvisible) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
tableID | Longint | Number of the table in the database | |
tableInvisible | Longint | Table visibility | |
fieldNames | Array | Array of fields names for target table | |
fieldTypes | Array | Array of field types for target table | |
fieldLengths | Array | Array of field lengths for target table | |
fieldIndexed | Array | Array of field "index" properties for target table | |
fieldInvisible | Array | Array of field "visible" properties for target table | |
Function result | Longint | Error code result for the function |
Description
OP Get field properties returns the name and type of all fields in the specified table. It also returns the length of all alpha fields in the table and indicates whether or not each field is indexed, and whether or not each field is invisible.
tableInvisible returns 1 if tableID is invisible. Otherwise, tableInvisible returns 0.
fieldNames must be an array of type String or Text.
fieldTypes must be an array of type String, Text, Real, Integer or Longint. The values returned in fieldTypes depend on the type of array passed:
Alpha Array | Numeric Array |
"Alphanumeric" | 0 |
"Real" | 1 |
"Text" | 2 |
"Picture" | 3 |
"Date" | 4 |
"Boolean" | 6 |
"Subfile" | 7 |
"Integer" | 8 |
"Long Integer" | 9 |
"Time" | 11 |
fieldLengths can be an array of type String, Text, Real, Integer, or Long Integer. If the array is of type String or Text, the value passed is a numeric string. If the array is of type Real, Integer, or Long Integer, the value passed is a number. The values returned by Indexed vary depending on the type of array passed:
Alpha Array | Numeric Array | Boolean Array | |
Field is indexed | "Indexed" | 1 | True |
Field is not indexed | "" (empty string) | 0 | False |
The values returned by InvisibleField vary depending on the type of array passed:
Alpha Array | Numeric Array | Boolean Array | |
Field is invisible | "Invisible" | 1 | True |
Field is not invisible | "" (empty string) | 0 | False |
Error Codes
If OP Get fields properties executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
-108 | Not enough memory to perform this operation. |
-9972 | File number is out of range. |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10135 | Invalid parameter type. |
10136 | The connection does not exist. |
10154 | This command cannot be executed right now. |
Example
In this example, arrays are used to store information about fields in a file.
C_LONGINT($File;$ErrCode) 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 Load network component ($CompID) $ErrCode:=OP Open connection ($ServerID;$ConnectID;"4D 3.2";"Designer";$Password;"Nomad") $ErrCode:=OP Get field properties ($ConnectID;$File;$Invisible;aNames;aTypes; aLength;aIndexes; aInvisible)
See Also