DictTable.fieldCnt2Id Method

Returns the field ID of the field that is specified by an index.

Syntax

public FieldId fieldCnt2Id(int cnt, [TableScope tableScope])

Run On

Called

Parameters

  • cnt
    Type: int
    A one-based index of the fields of a table, in AOT order, that represents the field ID to retrieve.

Return Value

Type: FieldId Extended Data Type
The field ID of the field that is specified by an index.

Examples

The following example shows the retrieval of the fields of a table by index.

DictTable dt; 
int       i, fId, tId; 
DictField df; 
str       strFieldName; 
 
tId = tablenum(CustTable); 
 
dt = new DictTable(tId); 
 
if (dt) 
{ 
    for (i=1; i <= dt.fieldCnt(); i++) 
    { 
        fId = dt.fieldCnt2Id(i); 
        df = new DictField(tId, fId); 
        strFieldName = (df ? df.name() : ""); 
        print(strfmt("%1) %2 %3", i, fId, strFieldName)); 
    } 
}

See Also

DictTable Class

DictTable.fieldCnt Method

DictField Class