AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.10.2017, 11:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
ievgensaxblog: D365FOE. Issue with enums that have “Use Enum Value” property set to “No”.
Источник: https://ievgensaxblog.wordpress.com/...rty-set-to-no/
==============

Recently we have noticed incorrect behavior of enums that have “Use Enum Value” set to “No” and have gaps in enum values. These enums use values from properties when populated from user interface, however, X++ code uses generated values, that cause inconsistent behavior and data corruption.

To illustrate this issue, we will create new enum with two values: 0 and 10. Also we need to set “Use Enum Value” property to “No”.





Zero:



Ten:



Also, we need simple table that has only one field, form to populate this field from UI and job to create data from X++.

Table:



Form:



Runnable class:



Let’s run the class and check data in DB and UI.

In DB value is equal to value from enum properties – 10:


On the form we can see empty value:



Let’s create new record using UI and check what is saved to DB.





As you can see, value is equal to 1. For these enums value entered from UI will never be equal to value entered from X++ code, so if it is created in X++ user would see empty values, if it is created from UI X++ comparison like:

If (myTable.MyEnum == MyEnum::Ten)  

would always return false, even if user see “Ten” on UI, because values are different.

It was a common practice to have gaps in enum values for different layers, so you could avoid conflicts when new values are created in new version or a hotfix. AssetTransType is a good example, where localization related values start from 100, because they used to be on another layer.

However, most of standard enums use enum values, so probably that is why this bug was not spotted before.

As a good citizen, I filled a bug, but I have a sneaky suspicion that it won’t be fixed soon, so be aware of this volatile mix, try to avoid changing “Use Enum Value” property and review your enums in case you have one!




Источник: https://ievgensaxblog.wordpress.com/...rty-set-to-no/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
NAV Team: NAV Patterns of the Week: No. Series Blog bot Dynamics CRM: Blogs 0 05.08.2013 18:00
fed: Net requirements update in MRP Module and Working Set of MRP Blog bot DAX Blogs 14 08.05.2012 13:09
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23
wiki.dynamicsbook: Changes Made in Navision Attain 3.01B Blog bot Dynamics CRM: Blogs 0 21.08.2008 20:43
wiki.dynamicsbook: Changes Made in Navision Attain 301 Blog bot Dynamics CRM: Blogs 0 19.08.2008 13:44

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:45.