Xmlport performance problem

RMarc
Member Posts: 36
Hi and happy new year for all!! 
I have a performance problem with a import xmlport and i dont understand why... My XMLport import a TXT file with lines of sales invoices. The file, usually have 1880 lines.
The code in the xmlport evaluate imported elements and generate new sales invoice in Dynamics NAV 2009 SP1. The xmlport not perform complex business logic, but for example, will cost approximately 10 minutes to process 50 records...
The extrange thing is i have a dataport with the same code in the same SQL database and this is very fast.
The code to run the xmlport is:
CLEAR(ImportXMLPort);
ImportXMLPort.GetParameters(var1,var2);
FileIn.OPEN(InvHdrTxt);
FileIn.CREATEINSTREAM(StreamIn);
ImportXMLPort.SETSOURCE(StreamIn);
ImportXMLPort.IMPORT;
FileIn.CLOSE();
Anyone have any idea who can help me, please?
Thanks in advance!!!

I have a performance problem with a import xmlport and i dont understand why... My XMLport import a TXT file with lines of sales invoices. The file, usually have 1880 lines.
The code in the xmlport evaluate imported elements and generate new sales invoice in Dynamics NAV 2009 SP1. The xmlport not perform complex business logic, but for example, will cost approximately 10 minutes to process 50 records...
The extrange thing is i have a dataport with the same code in the same SQL database and this is very fast.
The code to run the xmlport is:
CLEAR(ImportXMLPort);
ImportXMLPort.GetParameters(var1,var2);
FileIn.OPEN(InvHdrTxt);
FileIn.CREATEINSTREAM(StreamIn);
ImportXMLPort.SETSOURCE(StreamIn);
ImportXMLPort.IMPORT;
FileIn.CLOSE();
Anyone have any idea who can help me, please?
Thanks in advance!!!
0
Answers
-
Have you tried modifying the XML Port so that it only reads the data (and does not do any updates) so that you can see if the issue is with the reading of XML file or processing of the data?
1880 records doesn't sound like it should take that long to process and there could be a problem with the XML Parser or something else. How big is the data file that you are trying to import? I've seen NAV struggle with files over 200Mb in size.0 -
jlandeen wrote:Have you tried modifying the XML Port so that it only reads the data (and does not do any updates) so that you can see if the issue is with the reading of XML file or processing of the data?
1880 records doesn't sound like it should take that long to process and there could be a problem with the XML Parser or something else. How big is the data file that you are trying to import? I've seen NAV struggle with files over 200Mb in size.
Hi jlandeen, and thanks for your reply.
The files that i'm trying to import ara between 200 and 300 Kb, I don't think the files are very big...
I'll try what you've said me and see if the problem really is in updating data or is in XMLPort's reading.
Thanks a lot!0 -
Yes 200 to 300Kb really doesn't sound like a large file size. I definately think your next step is to break apart the XML file processing and parsing from the actual DB processes of write/read/modify/delete so that you can see where the performance is breaking down. Typically I've found NAV to be pretty good at reading and processing XML files.0
-
Hi jlandeen,
Thnaks very much for your reply, and sorry for the delay in my reply.
Finally, is sure that the problem isn't the file, because i've tested XMLPort with a file with a single row and also slows down the system.
At this point, I decided to comment the code that was on the trigger OnBeforeInsertRecord and reading of data has been very rapid. This means that the problem is in the code of the trigger.
After analyzing the code, I noticed that the problem appears in the following statement:
SalesHeader.VALIDATE("Sell-to Customer No.",Cust."No.");
If I change the statement to assign the value without making VALIDATE, the behavior is fast.... ](*,)
Any idea??
Thanks a lot!0 -
Depending on any custom logic (and even base logic) validation on the Customer No. field in a sales order can trigger a whole lot of logic. Typically there will be updates to the shipping address, company address, tax location and other values on the header of the record.
I find in a lot of implementations there is also conditional logic to perform custom checks and update other values and tables when a new order is created or assigned to a customer. What happens when this action is performed by a user when inserting a new sales order? Does it take a long time for the system to respond and update the header information?0 -
The system creates sales invoices, so business logic that runs is less than when you insert a sales order.
What I find curious is that when a user inserts a new sales invoice, the system is very flexible, and this process is running with Dataports, and is pretty fast.
However, thanks to your comment, I tried to post some of the code, specific to this database, and that's the problem.
I do not understand because it is only slow when the call is made from a XMLport, but honestly, all the invoices that are loaded through this system, do not need this part of the code, so I resolved the case on! \:D/ \:D/
Thank you very much for everything jlandeen!!!!0 -
Glad to hear that you were able to sort it out!
You should flag this post as solved with the little green check mark too - I think they like when that happens on here0 -
Hi jlandeen
Sorry but.... How i flag this post as solved? Where is the green check mark... ? #-o #-o
Thanks!!0 -
You can search miboso for how to do that
, but quickly
Modify your first post and you'll have a extra option near your subject. Attribute I think.
Set the attribute to solved and submit.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions