OP Get table properties

4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next

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

ParameterTypeDescription
connectionIDLongintConnection ID with target server
tableIDLongintNumber of the table in the database
tableInvisibleLongintTable "visible" property
tableLeftLongintTable left graphical coordinate
tableTopLongintTable top graphical coordinate
tableRightLongintTable right graphical coordinate
tableBottomLongintTable bottom graphical coordinate
fieldNamesArrayArray fo field names for target table
fieldTypesArrayArray of field types for target table
fieldLengthArrayArray of field lengthes for target table
fieldIndexedArrayArray of "indexed" properties for target tables
fieldUniqueArrayArray of "unique" properties for target table
fieldInvisibleArrayArray of "visible" properties for target table
fieldEnterableArrayArray of "Enterable" properties for target table
fieldModifiableArrayArray of "Modifiable" properties for target table
fieldMandatoryArrayArray of "Mandatory" properties for target table
fieldRelatedTableArrayArray of related table numbers for target table
fieldRelatedFieldArrayArray of related field numbers for target table
fieldRelatedWildArrayArray of "field used for wildcard" numbers
for target table
fieldManyToOneArrayArray of "many to one" automatic relation
property for target table
fieldOneToManyArrayArray of "one to many" automatic relation
property for target table
fieldDelControlArrayArray of "deletion control" property for target table
fieldWhatControlArrayArray of "deletion control action" property
for target table
fieldAutoAssignArrayArray of "auto-assign related value" property
for target table
Function resultLongintError 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 ArrayNumeric 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:

AlphaNumericBoolean
ArrayArrayArray
Field is indexed"Indexed"1True
Field is not indexed"" (empty string)0False
Field is invisible"Invisible"1True
Field is not invisible"" (empty string)0False
Field is unique"Unique"1True
Field is not unique"" (empty string)0False
Field is enterable"Enterable"1True
Field is not enterable"" (empty string)0False
Field is modifiable"Modifiable"1True
Field is not modifiable"" (empty string)0False
Field is mandatory"Mandatory"1True
Field is not mandatory"" (empty string)0False

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 CodeDescription
-108Not enough memory to perform this operation.
-9972File number is out of range.
10128The 4D Open for 4th Dimension package has not been initialized.
10135Invalid parameter type.
10136The connection does not exist.
10154This 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

OP Get all tablenames.


4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next