PA_GetFieldProperties


version 2003


PA_GetFieldProperties (tNum; fNum; fieldKind; stringLength; isIndexed; fAttributes)

Parameter Type Description
tNum short Table number
fNum short Field number
fieldKind PA_FieldKind * Kind of field
stringLength short * Length of the string field
isIndexed char * 1 = Indexed field
fAttributes long * Field attributes

Description

The routine PA_GetFieldProperties returns different information about the given field.

fieldKind

is the kind of the field, a returned value from the PA_FieldKind enum, defined as this:
typedef enum
{
eFK_InvalidFieldKind= -1,
eFK_AlphaField= 0,// Alphanumeric field (from 2 to 80 characters)
eFK_RealField= 1,// Numeric field (Double or Extended value)
eFK_TextField= 2,// Text field (up to 32000 characters)
eFK_PictureField= 3,// Picture field (virtually any block of data)
eFK_DateField= 4,// Date field
eFK_BooleanField= 6,// Boolean field
eFK_SubfileField= 7,// Subfile field
eFK_IntegerField= 8,// Integer field (-32768..32767)
eFK_LongintField= 9,// Long Integer field (-2^31..(2^31)-1)
eFK_TimeField= 11,// Time field
eFK_BlobField= 30// BLOB field
} PA_FieldKind;

stringLength

is the length of the field expressed in characters. It may vary from 2 to 80 characters. The length is significant only for alphanumeric fields and can be ignored for all other types of fields.

isIndexed

is 1 if the field is indexed, otherwise it is 0. Note that for non-indexable fields (text, Pictures, blobs, subtables), this value can be ignored

fAttributes

are the attributes of the Field (such as Mandatory), returned bit field coded on the Low Word of fAttributes.

Bit number Set to 1 if the Field Can be ignored if
15 Is Indexed Text, Picture or SubTable
14 Is Indexed unique SubTable Boolean, Text, Picture, or if bit
15 is not set
13 Is Mandatory SubTable
12 Is Modifiable Picture or SubTable
11 Is Mandatory SubTable
10 Is Modifiable SubTable
8 Is Invisible SubTable
6 Has an Automatic Text, Picture or SubTable
Many to One relation*
5 Has an Automatic Text, Picture or SubTable
One to Many relation*
2 and 1 Has an Automatic One to Many Allow Deletion Control in the
relation* whose "Deletion Control" Preferences Dialog box is not checked,
option is: (equivalent to Leave Related Many
00 Relational Integrity database intact)
option is not active
01 Leave related many intact
10 Delete related many
11 Can't delete related many
0 Has an automatic One to Many Text, Picture, or SubTable, or if bit 5 is
relation* whose "Auto assign not set
related value" attribute is set

*The relation starts from this Field.

Note that the definition of a field may change during a session if the database is not compiled a user may edit field definitions in the Design environment while the 4D Extension is running in another process.

Example

Get the visible of a field

   #define kINVISIBLE_MASK      0x00000100
   
   char IsFieldVisible (short tNum, short fNum)
   {
      PA_FieldKind   kind;
      short         len;
      char         isIndexed;
      long         attrs;
      
      PA_GetFieldProperties(tNum, fNum, &kind, &len, &isIndexed, &attrs);
      if(PA_GetLastError())
         return 0; // or error code ?
      
      return (char) ( (attrs & kINVISIBLE_MASK) ? 1 : 0 );
   }

See Also

PA_GetFieldList , PA_GetFieldName , PA_GetFieldRelation .

Error Handling

Use PA_GetLastError to see if an error occurred (bad table/field numbers).