Источник:
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.
DictClassObject 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;
}
DictConfigurationKeyObject 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\valueCanBeProduced
Example 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