Proper way to loop through table fields?

Hello,

I would like to be able to iterate through all the fields in a table using the DictField or SysDictField class?

Thank you!

Use this

static void iterateFields(Args _args)
{
DictTable dictTable;
DictField dictField;
int fldCnt;
;

dictTable = new DictTable(tablenum(CustTable));

for (fldCnt = 1; fldCnt <= dictTable.fieldCnt() ; fldCnt++)
{
dictField = new DictField(tablenum(CustTable), dictTable.fieldCnt2Id(fldCnt));
info(strfmt("%1", dictField.name()));

}
}

That’s exactly what I am looking for. Thank you!