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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.04.2015, 23:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
DeniZone: Assigning enum value to variable from enum name
Источник: http://denizone.blogspot.com/2015/04...able-from.html
==============

Working with utilities there are alot of file exchanges - alot.

Today we got a strange case though. In a file we receive a value that represents the name of a enum value, e.g. E17. The label of the enum value is Consumption, so we wanted to assign the value to a field value in a given table, so this is what we came up with

// must assign Consupmtion and not E17
JournalConnection journalConnection;
str typeOfMeteringPoint = "E17";

SysDictEnum dictEnum = newSysDictEnum(enumNum(ConnectionTypes));
;


journalConnection.type = dictEnum.symbol2Value(typeOfMeteringPoint);









we also came up with this one where we inserted the option of a small if-statement to check if the name of the enum value is found on the enum:

JournalConnection journalConnection;
ConnectionTypes connectionTypes;
str typeOfMeteringPoint = "E17";

SysDictEnum dictEnum = newSysDictEnum(enumNum(ConnectionTypes));
Counter values = dictEnum.values();
int idx;
;

for(idx = 0; idx< values ;idx++)
{
if(typeOfMeteringPoint == dictEnum.index2Symbol(idx))
{
journalConnection.type = str2enum(ConnectionTypes,dictEnum.index2Name(idx));
}

}


Источник: http://denizone.blogspot.com/2015/04...able-from.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Map the Full Product name from Dynamics AX for the CRM Connector Blog bot DAX Blogs 0 22.02.2015 14:11
DeniZone: More on AX 6 from the Techincal Conference Programme Blog bot DAX Blogs 5 18.10.2010 12:40
Jim Wang: Get Entity/Attribute's Display Name from CRM database Blog bot Dynamics CRM: Blogs 0 28.03.2009 01:05
Khue Trinh: AX 2009 Quality Management - Quality Control Blog bot DAX Blogs 1 04.07.2008 16:01
Вопрос про Demand Planner slava09 DAX: Функционал 4 25.09.2006 11:43

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:09.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.