Find extended type in table
This jobs checks if a given extendedType is found on a table:
It is called with a table id and a extendedTypeNum.
static void findExtTypeInTable(Args _args)
{
boolean fieldInTable(TableId _tableId, extendedTypeId _typeId)
{
SysDictTable sysDictTable = SysDictTable::newTableId(_tableId);
SysDictField sysDictField;
int i, fieldId;
;
for (i=1; i<= sysDictTable.fieldCnt(); i++)
{
fieldId = sysDictTable.fieldCnt2Id(i);
sysDictField = sysDictTable.fieldObject(fieldId);
if (sysDictField.typeId() == _typeId)
return true;
}
return false;
}
boolean fieldInTableTxt(TableId _tableId, extendedTypeId _typeId)
{
if (fieldInTable(_tableId, _typeId))
info(strfmt("Type %1 found in table %2",
extendedTypeId2name(_typeId),
tableid2name(_tableId)));
else
warning(strfmt("Type %1 does not exists in table %2",
extendedTypeId2name(_typeId),
tableid2name(_tableId)));
}
fieldInTableTxt(tablenum(SalesTable), extendedTypeNum(InventDimId));
fieldInTableTxt(tablenum(SalesLine), extendedTypeNum(InventDimId));
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.