Dataport "hangs"

Hi all,

I’ve developed a Dataport, to import some sales-data into Navision.

The problem is that my dataport is hanging when it is finished reading the file, and I have to close Navision the hard way.

I’ve tried to insert a COMMIT at the end of the OnAfterImport-trigger, just to check if the file actually has been read fully.
It only missed the last line.
I’ve tried to shorten the file, with the same result.

I’m using NAV4.02, on SQL2005.
But I also tried this in a native-DB, with the same result.

The file that I try to import is an Excel-file, saved as .csv.

Also I have tried to make a Report for the import, and this performs as it should.
(Doesn’t hang [:D])

Any ideas as to what is going on here?



Open the file in a text editor and check for blank lines or white space at the end of the file.


I have had a similarly issue once. This was caused by a missing CR or LF (Carriage Return/Linefeed) in the end of each line (the file was created by an external application) but since you are saving the file from Excel it is probably some else that is causing you issues. Have you changed the FieldSeparator, RecordSeparator or DataItemSeparator in the dataport from the standard values?



Hi Guys,

Thanks for the input.

I’ve solved this

I’ve made sure that the file contains a CR/LF at the end.
I’ve even tried to open the file with notepad, and copy the data into a new notepad-file, just to be sure.
Same result.

However, Claus, Your question to whether or not I’ve changed the seperators, lead me to try something.
My file contain some nonsens-data in the top, then a blank line just before the actual data.
So I had set the DataItem-seperator to , and then tested the value of my 1. dataport-field, to determine if the actual data was reached.
Now I’ve inserted another DataItem, and set the DataItem-seperator back to <>.
This did the trick.

I just assumed that when Navision reached the end of the file, my dataport would automatically close.
This is apparently not the case.

Seems like I’ve learned something new today.

Thanks again for the input.



You may want to find out why this happens.
Solving the problem immediatelly is a good start. But
you do want to make sure the file is correct in the future.

I had similar problems with an Oracle system. Some months later the oracle file is generated with wierd things.

Some other client the RedHat person didn’t know I need those records not to contain the wierd symbol. And to have CR+LF at the end of each record.
He changed it on his end to make it a permanent fix.

Good luck, try to avoid the Excel thing on a week basis if you are going that route.