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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.06.2011, 02:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,495 / 847 (79) +++++++
Регистрация: 28.10.2006
Rahul Sharma: Modify Dynamics AX Standard Excel Import to Include - Update existing records - rule
Источник: http://feedproxy.google.com/~r/Rahul...ard-excel.html
==============

Sometimes we need to import an excel file that contains existing and new records. With standard Dynamics AX 2009 you don't get an option (import rule) where you can specify ONLY import and update existing records. Below are standard AX excel import rules...


To add a rule that says "Update existing records" only.

Modify Enum SysDataExcelImportRule to add a new element for update.



Note: If you noticed I have inserted new Enum element with value 101, which is far away what Microsoft is using. It is a best practice to keep some difference between the enum values, so if Microsoft inserts new standard enum elements later then our custom enum element do not overlap with the standard. It helps when you upgrade your AX system in future.

Modify Class SysDataImportExcel, method ImportData as stated below. Just add lines having related modification comments.

1: switch (importRule) 2: { 3: //#N by Rahul Sharma on 19Apr2011 for RAH_ExcelImportRule_UpdateOnlyOption 4: //added update only option 5: case SysDataExcelImportRule::RAHUpdate : 6: case SysDataExcelImportRule::InsertAndUpdate : 7: selectForUpdate = true; 8: 9: case SysDataExcelImportRule::InsertNew : 10: updCommon = this.recordExist(_dictTable, _curcommon, selectForUpdate); 11: break; 12: }

1: if (updCommon.RecId) 2: { 3: //existing standard code 4: } 5: else 6: { 7: //#N by Rahul Sharma on 19Apr2011 for RAH_ExcelImportRule_UpdateOnlyOption 8: //break if its a new record 9: if (importRule == SysDataExcelImportRule::RAHUpdate) 10: return false; 11: 12: selectForUpdate = false; 13: updCommon = _curcommon; 14: }

After these small changes, you now should be able to import and update only existing records using standard AX excel import.



You can download the AX Project from here.


Join me on facebook and feel free to post your comments / feedback / queries.

Join me on facebook | twitter | linkedin !!!






Источник: http://feedproxy.google.com/~r/Rahul...ard-excel.html
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Sample Design Patterns: Microsoft Dynamics AX - Remedy for slow Microsoft Excel import Blog bot DAX Blogs 0 29.05.2011 17:13
dynamics-ax: Interview with Microsoft's Lachlan Cash on his new role, AX 2012 and more Blog bot DAX Blogs 6 22.04.2011 14:55
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22: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
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

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

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

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