I would like ask if it is possible to find the fieldId of a specific table through the labelId of the field.
Thanks in Advance
One of the possible solutions:
static void FindTableFieldsByLabel(Args _args)
{
TableId tableId = tableNum(AccountingDistribution);
str findLabel = literalStr('@SYS132687');
SysDictTable dictTable;
SysDictField dictField;
FieldId fieldId;
dictTable = new SysDictTable(tableId);
fieldId = dictTable.fieldNext(0);
while (fieldId)
{
dictField = dictTable.fieldObject(fieldId);
if (dictField.isSql() && !dictField.isSystem()
&& dictField.labelLabel() == findLabel)
{
info(strFmt('Field name: %1', dictField.name()));
}
fieldId = dictTable.fieldNext(fieldId);
}
info('Job completed');
}
You can also use dictField.labelDefined()
if you want to ignore the labels set on extended data types and not on the table fields.