version 1.5
OP Get table properties (connectionID; tableID; tableInvisible; tableLeft; tableTop; tableRight; tableBottom; fieldNames; fieldTypes; fieldLength; fieldIndexed; fieldUnique; fieldInvisible; fieldEnterable; fieldModifiable; fieldMandatory; fieldRelatedTable; fieldRelatedField; fieldRelatedWild; fieldManyToOne; fieldOneToMany; fieldDelControl; fieldWhatControl; fieldAutoAssign) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
tableID | Longint | Number of the table in the database | |
tableInvisible | Longint | Table "visible" property | |
tableLeft | Longint | Table left graphical coordinate | |
tableTop | Longint | Table top graphical coordinate | |
tableRight | Longint | Table right graphical coordinate | |
tableBottom | Longint | Table bottom graphical coordinate | |
fieldNames | Array | Array fo field names for target table | |
fieldTypes | Array | Array of field types for target table | |
fieldLength | Array | Array of field lengthes for target table | |
fieldIndexed | Array | Array of "indexed" properties for target tables | |
fieldUnique | Array | Array of "unique" properties for target table | |
fieldInvisible | Array | Array of "visible" properties for target table | |
fieldEnterable | Array | Array of "Enterable" properties for target table | |
fieldModifiable | Array | Array of "Modifiable" properties for target table | |
fieldMandatory | Array | Array of "Mandatory" properties for target table | |
fieldRelatedTable | Array | Array of related table numbers for target table | |
fieldRelatedField | Array | Array of related field numbers for target table | |
fieldRelatedWild | Array | Array of "field used for wildcard" numbers | |
for target table | |||
fieldManyToOne | Array | Array of "many to one" automatic relation | |
property for target table | |||
fieldOneToMany | Array | Array of "one to many" automatic relation | |
property for target table | |||
fieldDelControl | Array | Array of "deletion control" property for target table | |
fieldWhatControl | Array | Array of "deletion control action" property | |
for target table | |||
fieldAutoAssign | Array | Array of "auto-assign related value" property | |
for target table | |||
Function result | Longint | Error code result for the function |
Description
OP Get table properties returns extensive information about a table and the fields it contains.
fieldTypes can be a Text, String, Integer, Long Integer, or Real array. 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 |
fieldLength can be Text, String, Integer, Long Integer, or Real arrays. If the array is of type Text or String, the lengths are returned in text form.
fieldRelatedTable, fieldRelatedField, and fieldRelatedWild can be Integer, Long Integer, or Real arrays. fieldRelatedTable only returns a related table number if the file described by tableID is the One table in a relation to another table.
fieldIndexed, fieldInvisible, fieldUnique, fieldEnterable, fieldModifiable, and fieldMandatory can be String, Text, Integer, Long Integer, Real, or Boolean arrays. The values returned depend on the types of arrays passed, based on the following table:
Alpha | Numeric | Boolean | |
Array | Array | Array | |
Field is indexed | "Indexed" | 1 | True |
Field is not indexed | "" (empty string) | 0 | False |
Field is invisible | "Invisible" | 1 | True |
Field is not invisible | "" (empty string) | 0 | False |
Field is unique | "Unique" | 1 | True |
Field is not unique | "" (empty string) | 0 | False |
Field is enterable | "Enterable" | 1 | True |
Field is not enterable | "" (empty string) | 0 | False |
Field is modifiable | "Modifiable" | 1 | True |
Field is not modifiable | "" (empty string) | 0 | False |
Field is mandatory | "Mandatory" | 1 | True |
Field is not mandatory | "" (empty string) | 0 | False |
fieldManyToOne, fieldOneToMany, fieldDelControl, fieldWhatControl, and fieldAutoAssign can be Integer, Long Integer, Real, or Boolean arrays. 4D Open will return 1 (True) or 0 (False) in numeric arrays and "True" or "False" in Boolean arrays.
Error Codes
If OP Get table 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
The following code lists the invisible files and fields in a database:
C_LONGINT($Invisible;$L;$T;$R;$B;$ErrCode;$FileID;$FldID) ARRAY STRING(31;artName;0) ` ConnID is a valid connection reference number $ErrCode:=OP Get all tablenames (ConnID;artName) If ($ErrCode=0) ARRAY STRING(31;arFldName;0) `Can be String or Text ARRAY INTEGER(arFldType;0) ` Can be Integer, LongInt, Real, String or Text ARRAY INTEGER(arFldLen;0) ` Can be Integer, LongInt, Real, String or Text ARRAY INTEGER(arFldInd;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY BOOLEAN(arFldInv;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY INTEGER(arFldUni;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY BOOLEAN(arFldEnt;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY BOOLEAN(arFldMod;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY BOOLEAN(arFldMan;0) ` Can be Integer, LongInt, Real, Boolean, String or Text ARRAY INTEGER(arFldRelFl;0) ` Can be Integer, LongInt or Real ARRAY INTEGER(arFldRelFd;0) ` Can be Integer, LongInt or Real ARRAY INTEGER(arFldDis;0) ` Can be Integer, LongInt or Real ARRAY BOOLEAN(arFldAutM2O;0 ` Can be Integer, LongInt, Real or Boolean ARRAY BOOLEAN(arFldAutO2M;0) ` Can be Integer, LongInt, Real or Boolean ARRAY BOOLEAN(arFldDel;0) ` Can be Integer, LongInt, Real or Boolean ARRAY BOOLEAN(arFldRej;0) ` Can be Integer, LongInt, Real or Boolean ARRAY BOOLEAN(arFldUpd;0) ` Can be Integer, LongInt, Real or Boolean For ($tableID;1;Size of array(artName)) $ErrCode:=OP Get table properties (ConnID;$tableID;$Invisible;$L;$T;$R;$B;arFldName; arFldType;arFldLen;arFldInv;arFldInd;arFldUni;arFldEnt;arFldMod;arFldMan;arFldRelFl; arFldRelFd;arFldDis;arFldAutM2O;arFldAutO2M;arFldDel;arFldRej;arFldUpd) If ($ErrCode=0) If ($Invisible#0) MESSAGE("The table ["+artName{$tableID}+"] is invisible.") Else For ($FldID;1;Size of array(arFldName)) If (arFldInv{$FldID}) MESSAGE("The field ["+artName{$tableID}+"]"+arFldName{$FldID}+" is invisible.") End if End for End if End if End for End if
See Also