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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.05.2011, 17:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,584 / 848 (80) +++++++
Регистрация: 28.10.2006
Sample Design Patterns: Microsoft Dynamics AX - Remedy for slow Microsoft Excel import
Источник: http://www.bojanjovicic.com/post/Mic...el-import.aspx
==============

Recently I have been asked to help with solving an issue that involved reading data from Microsoft Excel (xls format) into Microsoft Dynamics AX.

Original approach was used with default set of classes for Microsoft Excel (SysExcelApplication, SysExcelWorksheets, SysExcelWorksheet, etc.). The excel file in question was very small but with a rather large number of columns (~150). About 200 reads were made per row. What made us investigate this further was the fact that import was quite slow. After doing some basic profiling (we used Microsoft .NET's System.Diagnostics.Stopwatch so we can cross-compare the results) we found out that the time required to process one row increases almost exponentially.

After that we developed a small application in Microsoft.NET/C# (with Microsoft Visual Studio) that was reading data from Excel using OleDbConnection class and saving it in Microsoft Dynamics AX using .NET Business Connector. The increase in speed was several orders of magnitude but what is also important is that near exponential growth of time per row was missing.

We then applied the same principle with Microsoft Dynamics in X++ using its set of classes for ADO access (CCADOConnection, CCADOCommand, CCADORecordset). The speed was still around 100 times greater than with default approach and ~2.5 times slower than .NET. With this set of classes we were lacking the ability to do arbitrary (e.g. accessing the previous row values) row access like in .NET, so some caching was needed. Still the speed increase was incredible. Below is the graph of time needed (in milliseconds) to process one row with all three approaches.


If you haven't tried this apporach, I suggest it. For it will surely outweight the time needed for implementation, especially with bigger or files with many columns. Connection string and row selection query (you can remove absolute row range) for .NET and X++ should look something like this:

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filename + ";" + "Extended Properties=Excel 8.0;";
rowQuery = strfmt("SELECT * FROM [Excel 8.0;HDR=NO;IMEX=1;Database=%1;].[%2$%3]", filename, "OrderWorkSheet", "A:EJ");





Источник: http://www.bojanjovicic.com/post/Mic...el-import.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
semanticax: Dynamics AX 2009 Installation - Application Blog bot DAX Blogs 0 22.12.2010 08:11
Sample Design Patterns: Shortcuts for Dynamics AX 2009 - New Poster Blog bot DAX Blogs 0 31.07.2010 12:05
Developer for Microsoft Dynamics AX Certification Roadmap Blog bot DAX Blogs 1 13.05.2009 16:17
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06

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

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

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