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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.10.2012, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
ax-erp: What are the objects Dict* and How can we use them?
Источник: http://microsoft-dynamics-ax-erp.blo...ow-can-we.html
==============


In some cases we need to write some codes in Dict objects. If we look under AOT\System Documentation\Classes node, here are the objects we will discuss in this post.


Dict objects are generally used for creating a object of related type (for DictClass e.g. CustBalanceList class), getting information about that object (for DictClass e.g. is class defined Abstract, Final or is Runnable {has main method} ) etc.
DictClass
Object can be constructed by “new” word (Params: ClassId). Mostly and effectively used for creating a child class (if we know classId of it).
Example usage in AXClasses\VenOutPaymRecord\newVendOutPaymRecordExample code //A child class will be created by using dictclass
DictClass dictClass;
VendOutPaymRecord vendOutPaymRecord; // parent class is defined
;
if (! _vendPaymModeSpec.classId)
{ // Payment mode specification has the child class id
return null;
}
if (! SysDictClass::isSuperclass(_vendPaymModeSpec.classId, classNum(VendOutPaymRecord)))
{ //Be sure if child class is really child
return null;
}
dictClass = new DictClass(_vendPaymModeSpec.classId); //Initialize dictclass object by child class id
vendOutPaymRecord = dictClass.makeObject(); // Create real child class by calling makeObject method
if (! vendOutPaymRecord) // Check if class was made or not
{
return null;
}

DictConfigurationKey
Object can be constructed by “new” word (Params: ConfigurationKeyId). Mostly used for checking if configuration key is enabled or not
Example usage in AXClasses\PurchLineType\interCompanyMirrorExample code //Check if SalesDeliveryDateControl configuration key is enabled
if (new DictConfigurationKey(configurationkeynum(SalesDeliveryDateControl)).enabled())
DictEnum
<blockquote style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; font-style: italic; line-height: 24px; margin: 0px; padding: 0px 3em; quotes: none; vertical-align: baseline;">Object can be constructed by “new” word (Params: EnumId). Mostly used for returning all of the elements of any enum object and accessing name of them.
Example usage in AXClasses\InventItemType\valueCanBeProducedExample code //Check if SalesDeliveryDateControl configuration key is enabled
DictEnum dictEnum;
Counter i;
InventItemType inventItemType;
str itemTypeTxt;
;
<div style="background-color: transparent; border: 0px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;"> dictEnum = new DictEnum(enumnum(ItemType)); // ItemType is a variable that value determined at outer of method earlier
for (i=0;i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


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

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

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