Monday, 16 May 2011

ExtendedTypeId of Enum and EDT

Just a quick post about the error encountered.
I was asked to debug an error and it has been found that it was due to developer is trying to use the "SysDictType()" class to look for the ExtendedTypeId of an enum. The code is quite dynamic, it accept the input from another setup table, which by default, it won't know what's the field that is coming in.

On the generic code, it seems like there's an assumption all field coming in will have EDT, therefore using only the SysDictType(), hence, error. The EDT name is needed for some other purpose, so I retain it. What I added is a branch to use either SysDictType() or SysDictEnum() based on the existence of the EDT.

Eg.
dictField = new DictField(tableId, fieldId);
if(dictField.typeId())
    extendedTypeId = new sysDictType(dictField.typeId()).extendedTypeId();
else if(dictField.enumId())
    extendedTypeId = new sysDictEnum(dictField.enumId()).extendedTypeId();


No comments:

Post a Comment