DictIndex.field Method [AX 2012]

Returns the ID of the specified field in the index.

public FieldId field(int fieldNumber)

Run On

Called

Parameters

fieldNumber
Type: int
The one-based index of the field in the index.

Return Value

Type: FieldId Extended Data Type
The ID of the field that is specified by fieldNumber; 0 (zero) if fieldNumber does not represent a valid field.

The following example shows the retrieval of each field in an index. The name of each field is displayed by using a loop.

Dictionary dict; 
DictTable  table; 
DictIndex  idx; 
DictField  field; 
int i; 
 
dict = new Dictionary(); 
table = new DictTable(dict.tableName2Id("Address")); 
idx = new DictIndex(table.id(), table.indexName2Id("AddrIdx")); 
for (i=1; i <= idx.numberOfFields(); i++) 
{ 
    field = new DictField(table.id(), idx.field(i)); 
    print field.name(); 
}

Community Additions

ADD
Show: