Reflection code to iterate on the primary index of the table
Views (1791)
Below is the job that contains code to retrieve the fields in a primary index of a table
static void IndexFieldsReflectionJob(Args _args)
{
DictIndex dictIndex;
DictTable dictTable = new DictTable(tableNum(testTable);
IndexId indexId;
int indexCounter;
fieldid fieldId;
DictField dictField;
indexId = dictTable.primaryIndex();
dictIndex = new dictIndex(dictTable.id(), indexId);
if (dictIndex)
{
for (indexCounter = 1; indexCounter < dictIndex.numberOfFields(); indexCounter++)
{
fieldId = dictIndex.field(indexCounter);
dictField = new DictField(dictTable.id(), fieldId);
print DictField.name();
}
}
pause;
}
This was originally posted here.

Like
Report
*This post is locked for comments