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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.04.2017, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxhints: Specifics of update_recordset crossCompany in AX 2012
Источник: http://dynamicsaxhints.blogspot.com/...recordset.html
==============

Have you ever tried to run update_recordset crossCompany statement?
Yes, it is possible. There are only 5 methods in standard AX code with such statement, but it can be very useful for data update jobs in multi company environment.

Tables:
TaxTransGeneralJournalAccountEntry.moveTaxForeignKeyToTaxTrans()
RetailLoyaltyConflictCard.migrateConflictCards()

Classes:
ReqDemPlanForecastChangeTracker.applyAllChanges()
ReleaseUpdateDB63_HRMMinor.updatePositionForecastBudgetAcctLine()
ReleaseUpdateDB63_HRMMinor.updatePositionForecastCompGroupRefPoint()

You must disable update method, database log and alerts, otherwise compiler will throw an error, for example:
transTable.skipDataMethods(true);
transTable.skipDatabaseLog(true);
transTable.skipEvents(true);
update_recordSet crossCompany transTable
setting loyaltyCardId = conflictCard.NewCardNumber
where transTable.loyaltyCardId == conflictCard.CardNumber
&& transTable.dataAreaId == conflictCard.Company;
If you are still not convinced, then there is another example below.
static void updateRecordSetCrossCompany(Args _args)
{
CustTable custTable;
PaymTermId oldPaymTermId = 'Net10', newPaymTermId = 'Net11';

// original state
while select crossCompany dataAreaId, count(RecId) from custTable
group by custTable.dataAreaId
where custTable.PaymTermId == oldPaymTermId
{
info(strFmt('Original: company %1 has %2
customers with PaymTermId %3.'
,
custTable.dataAreaId, custTable.recId, oldPaymTermId));
}

// update
custTable.skipDatabaseLog(true);
custTable.skipDataMethods(true);
custTable.skipEvents(true);

update_recordSet crossCompany custTable
setting PaymTermId = newPaymTermId
where custTable.PaymTermId == oldPaymTermId;

// new state
while select crossCompany dataAreaId, count(RecId) from custTable
group by custTable.dataAreaId
where custTable.PaymTermId == newPaymTermId
{
info(strFmt('New: company %1 has %2 customers with PaymTermId %3.',
custTable.dataAreaId, custTable.recId, newPaymTermId));
}
}
The job results are:



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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dynamicsaxhints: What is wrong: crossCompany update job in AX 2012 Blog bot DAX Blogs 0 27.03.2017 11:11
emeadaxsupport: AX Performance Troubleshooting Checklist Part 1B [Application and AOS Configuration] Blog bot DAX Blogs 0 05.09.2014 21:11
DAX: Microsoft Dynamics AX 2012 R3 is now available! Blog bot DAX Blogs 1 02.05.2014 23:00
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11

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

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

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