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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.07.2018, 12:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
sertandev: D365 FO: How to track data changes with AIF change tracking
Источник: http://devblog.sertanyaman.com/2018/...ange-tracking/
==============

You may need to track changes in a table or data entity for your own data staging or logging purposes. AIF framework has a change tracking feature which uses SQL server stored procedures to track data changes in AX tables, which is also the standard change tracking used by the DMF (DIXF) framework to handle incremental push of data. Implementation is as easy as below. Create a data entity (or a Query) for your source AX table and initialize DB tracking on your data entity using the code below (As of writing, in D365 FO Spring 2018 release) :

class AIFChangeTrackingInit { public static void main(Args _args) { AifChangeTrackingScope scope = 'ANDVisitScheduleTrackingScope'; DictDataEntity dictEntity = new DictDataEntity(tableNum(ANDVisitScheduleEntity)); boolean isSuccess = false; AIFSQLCDCENABLEDTABLES ctEnabledTables; new AifChangeTrackingPermission().assert(); aifchangetrackingconfiguration::initialize(); isSuccess = AifChangeTrackingConfiguration::enableChangeTrackingForDataEntity(scope,dictEntity,true, AifChangeTrackingType::SqlChangeTracking); info(strFmt("Is success : %1", isSuccess)); } }

Check if the initialization is successful from the infolog message, then insert, update or delete records in your source table for testing :



To list the changes, run the job below :

class AIFChangeTrackingTest { public static void main(Args _args) { DictDataEntity dictEntity = new DictDataEntity(tableNum(ANDVisitScheduleEntity)); AifChangeTracking aifChangeTracking; AifChangeTrackingTable changeTrackingTable; new AifChangeTrackingPermission().assert(); aifChangeTracking = AifChangeTracking::constructFromDataEntity(dictEntity, '', AifChangeTrackingType::SqlChangeTracking); changeTrackingTable = aifChangeTracking.getChanges(DateTimeUtil::utcNow()); while select changeTrackingTable { info(strFmt("Changed record : %1, type : %2 ", changeTrackingTable.KeyField_RecId, "Insert/Update")); } changeTrackingTable = aifChangeTracking.getDeletes(DateTimeUtil::utcNow()); while select changeTrackingTable { info(strFmt("Deleted record : %1, type : %2 ", changeTrackingTable.KeyField_RecId, "Delete")); } } } You will see the results of change tracking :



If you run the job once again, it will only show you the changes that are done after the previous retrieval process. This way it only picks up the incremental data updates, making it suitable for staging and data synchronization.











Источник: http://devblog.sertanyaman.com/2018/...ange-tracking/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: Changes to Microsoft Dynamics NAV Change Log System: How to Revert its Behavior Blog bot NAV: Blogs 0 23.06.2016 20:13
emeadaxsupport: How to perform a data center change (change of the physical location) where a SQL server 2008 R 2 cluster installation and MS Dynamics AX 4.0 is involved? Blog bot DAX Blogs 0 21.06.2014 19:19
emeadaxsupport: SEPA affected objects Blog bot DAX Blogs 0 29.11.2013 13:11
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра
Комбинированный вид Комбинированный вид

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

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

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