DictTable.fieldName Method

Returns the name of the field that is specified by field ID.

Syntax

public str fieldName(
    FieldId fieldId, 
   [DbBackend db, 
    int arrayindex, 
    FieldNameGenerationMode generationMode, 
    str tableAlias])

Run On

Called

Parameters

  • db
    Type: DbBackend Enumeration
    A DbBackend value that specifies the type of name to return; optional. This can be DbBackend::Native for the native name of the field, or DbBackend::Sql for the SQL name of the field. If the db parameter is not specified, DbBackend::Native is used.
  • arrayindex
    Type: int
    The one-based index to the array that is used for the field if the field is an array; optional. This parameter is ignored if the field is not an array.
  • tableAlias
    Type: str
    The alias name for the table; optional.

Return Value

Type: str
The name of the field that is specified by its field ID.

Remarks

If db is not specified, the DbBackend::Native object is used.

Examples

The following example shows the retrieval of field names of a table as specified by the field IDs.

DictTable dt; 
int       i, tId, fId; 
 
tId = tablenum(CustTable); 
dt = new DictTable(tId); 
 
if (dt) 
{ 
    for (i=1; i <= dt.fieldCnt(); i++) 
    { 
        fId = dt.fieldCnt2Id(i); 
        print(strfmt("%1) %2 %3", i, fId, dt.fieldName(fId))); 
    } 
}

See Also

DictTable Class

DictTable.fieldCnt2Id Method