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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 23.11.2012, 23:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,584 / 848 (80) +++++++
Регистрация: 28.10.2006
sumitsaxfactor: Replace a Financial Dimension in Default Dimensions–Condensed [AX 2012]
Источник: http://sumitsaxfactor.wordpress.com/...ensed-ax-2012/
==============

In my previous post on Replacing default dimensions, I had provided a job to replace one financial dimension within a default dimension. The job was pretty big and I always thought that Microsoft should have provided some way to do these operations easily. Luckily I found a class that has helped me to condense that job and make it pretty small. I am sharing that job here:

The dimensions for Customer record looks like this before running the job:



Here is the job to change the values. We will change the values for Business Unit, Department and Worker all with this simple job:

staticvoid replaceDefaultDimensionsCondense(Args _args)

{

/*

* In this job, we will replace the Business Unit Value from BU-001 to BU-002

* and fill in the values for Department as Dep-001 and Worker as 114

*/

CustTable custTable = CustTable::find(‘CUS-00004′); //Customer Record containing Financial Dimension

Struct struct = new Struct(); //Structure to hold the dimension values to replace

container defDimensionCon; //Container to prepare the required values and dimension attribute combination

DimensionDefault dimensionDefault; //Get the replaced dimension recid

DimensionAttributeSetItem dimAttrSetItem; //Table to get active dimensions for the legal entity

DimensionAttribute dimAttribute; //Table to get the Financial dimensions

int i; //For looping



//Loop for required dimensions

whileselect Name, BackingEntityType from dimAttribute

where dimAttribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit) ||

dimAttribute.BackingEntityType == tableNum(DimAttributeOMDepartment) ||

dimAttribute.BackingEntityType == tableNum(DimAttributeHcmWorker) &&

dimAttribute.Type != DimensionAttributeType::DynamicAccount

join dimAttrSetItem

where dimAttrSetItem.DimensionAttribute == dimAttribute.RecId &&

dimAttrSetItem.DimensionAttributeSet == DimensionCache::getDimensionAttributeSetForLedger()

{

//Add the Dimension name and display value to struct

if (dimAttribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit))

{

struct.add(dimAttribute.Name, ‘BU-002′);

}

elseif (dimAttribute.BackingEntityType == tableNum(DimAttributeOMDepartment))

{

struct.add(dimAttribute.Name, ‘DEP-002′);

}

elseif (dimAttribute.BackingEntityType == tableNum(DimAttributeHcmWorker))

{

struct.add(dimAttribute.Name, ’114′);

}

}



//Prepare the container

defDimensionCon += struct.fields();




<span><font face="Consolas"><font size="2">for (i = 1<font color="#000000">; i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
sumitsaxfactor: Replace a Financial Dimension in Default Dimensions [AX 2012] Blog bot DAX Blogs 0 18.01.2012 11:11
sumitsaxfactor: Defaulting Financial Dimensions [AX 2012] Blog bot DAX Blogs 0 28.12.2011 19:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
Khue Trinh: Setting up a link between a financial dimension and the site inventory dimension Blog bot DAX Blogs 0 27.09.2010 13:05

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

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

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