Hi,

If you look at the properties of the field, you will notice  that EnumType
field is empty but it indicates that there is some enum attached. Looks like
the Base Enum attached with the field has been deleted in AX 4.0.

In AX 2009 the Enum Type has been changed to ABC. This code will work in AX
2009.

Attached are the screen shots of the two in 4.0 and 2009.

Hope this resolves your query.

Regards,
Sumit

On Thu, Jun 25, 2009 at 9:09 PM, tkbsmanian <tkbsman...@yahoo.com> wrote:

>
>
> Hi All,
>
> Today i came up with one strange thing. I executed the script given below.
> Please go through and let me know why its happening in such a way...
>
> 1. static void enumId(Args _args)
> 2. {
> 3. EnumId enumId;
> 4. SysDictEnum sysDictEnum;
> 5.
> 6. SysDictTable sysDictTable;
> 7. SysDictField sysDictField;
> 8. ;
> 9.
> 10. sysDictTable = new SysDictTable(978);
> 11. sysDictField = new SysDictField(sysDictTable.id(), 1);
> 12.
> 13. if (sysDictField.enumId())
> 14. {
> 15. if (sysDictField.type() == Types::Enum
> 16. || sysDictField.baseType() == Types::Enum)
> 17. {
> 18. sysDictEnum = new SysDictEnum(sysDictField.enumId());
> 19.
> 20. if (sysDictEnum)
> 21. {
> 22. info (sysDictEnum.name());
> 23. }
> 24. }
> 25. }
> 26. }
>
> Note : TableName : DEL_BMBuildTable & FieldName : BuildID
>
> This script which ideally should print the BaseEnum name attached
> to the field, is not printing the value. The reason is, though the
> field is the type of Enum, no BaseEnum or EDT derived from
> BaseEnum attached to that field. Upto this ok.
>
> Line#18 of the above script failed on initializing because of
> no Enum attached to the field though it got passed at Line#13,
> since it's getting the value of 65535, which is max range for
> this object (type), which is actually not attached into the field.
>
> Now,
>
> 1. If i delete the enum attached to the field, which is type of Enum
> from standard SYS layer object, and after saved and sync, if i
> run the same script with the corresponding TableId and FieldId
> changes. It's printing the name. Why? How?
>
> 2. I created new table and added new field type of Enum and didn't
> attached any BaseEnum. Saved it. If i run the above script, with
> the corresponding TableId and FieldId changes, it's printing 'ABC'
> as default value. Why? How?
>
> Like said in the above two scenarios, why it is not happening for the
> tables like 'DEL_BMBuildTable'? (also configkey enabled)
>
> Any info/thought would be appreciated.
>
> Thanks && Regards,
> Balasubramanian Kumaran.
>
> 
>

Reply via email to