DictTable.indexUnique Method [AX 2012]

Returns the ID of the unique index for the table.

public IndexId indexUnique()

Run On

Called

Return Value

Type: IndexId Extended Data Type
The ID of the unique index for the table.

When there is more than one unique index on the table, the return value is one of the following:

  • The index that has the RecID column.

  • If no index has a record ID, the index that has the shortest size, based on the total size of columns.

  • If multiple indexes match with regard to the shortest size, the index that was added first.

The following example shows the retrieval of the unique index for a table.

DictTable dt; 
DictIndex di; 
 
dt = new DictTable(tablenum(SysUserInfo)); 
 
if (dt) 
{ 
     di = dt.indexObject(dt.indexUnique()); 
     if (di) 
     { 
        print di.name(); 
     } 
 
}

Community Additions

ADD
Show: