AX supports a compile time function dimOf
to return the count, but that is not available from .Net!
To rescue comes the DictField
class:
X++ code:
DictField df = new DictField(tablenum(CustTable), fieldnum(CustTable, AccountNum));
if (df)
{
print strfmt("The arraySize is %1.", df.arraySize());
}
You can make a X++ utility function, then call that:
static int arraySize(str tableName, str fieldName)
{
DictField df = new DictField(tableName2Id(tableName), fieldName2Id(tableName2Id(tableName), fieldName)));
return df ? df.arraySize() : -1;
}