DictTable.primaryKeyField Method

Returns the ID of the field that is used for the primary key of the table.

Syntax

public FieldId primaryKeyField()

Run On

Called

Return Value

Type: FieldId Extended Data Type
The ID of the field that is used for the primary key of the table; 0 (zero) if no single field serves as the primary key of the table.

Examples

The following example shows the retrieval of the field ID of the primary key for the table.

DictTable dt; 
DictField df; 
tableId   tID; 
fieldId   fID; 
 
tID = tablenum(CustTable); 
 
dt = new DictTable(tID); 
 
if (dt) 
{ 
   fID = dt.primaryKeyField(); 
   if (0 != fID) 
   { 
       df = new DictField(tID, fID); 
       if (df) 
       { 
            print strfmt("Primary key field name: %1", df.name()); 
       } 
   } 
}

See Also

DictTable Class

DictField Class

DictTable.primaryIndex Method