Compartir a través de


DictTable.Primarykeyfield Method

Definition

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

public:
 virtual int Primarykeyfield();
public virtual int Primarykeyfield ();
abstract member Primarykeyfield : unit -> int
override this.Primarykeyfield : unit -> int
Public Overridable Function Primarykeyfield () As Integer

Returns

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.

Remarks

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()); 
       } 
   } 
}

Applies to