Import Issue

This one’s weird… I have a .csv file with four lines. One of the columns has the following data across the rows AA, BB, BB, CC (not those exact values, but two character codes that are the same on the middle two lines.) I’ve put a message on the OnAfterImportRecord trigger to tell me the values so I know my code isn’t the problem. What’s happening is that the fourth record is importing BB. The first three work fine. Here’s the stupid bit… In the file, using Excel, I cut the entire fourth lines and pasted it a few lines down the document. I then cut and pasted it back to its original location directly under the other lines. I then saved it without doing anything else (and why does Excel make you click four times to save a .csv???) If I then import it, it works fine; CC is imported for the fourth line! I don’t want to tell the client (who I know reads this Forum - Hi!) that Excel is going to create anomolies like this from time to time that we can do nothing about! If it’s in any way relevant, the data is originally extracted from Lotus Notes. I don’t use smilies generally, but in this case a heart-felt [:(!]

If I understand correctly, your 4th line is the problem, and that line is actually your last line, right? I know that some software will differ in the way they produce export files. A text file usually has some characters to specify the end of line, end of file, etc. Ex: CR/LF vs CR only is Windows compared to Unix. Maybe the problem could be something like Lotus not putting the character at the end of the file, while Navision is expecting it. You would have to use an hexadecimal editor to see it. Could you test playing with the 4th line (removing it, copy the 3rd line twice so the 4th becomes the 5th, etc.) After this test, we will be able to see if the source of the problem is the way that Lotus generates the CSV…

Yes, I did a lot of line shifting / copying etc. Basically, whenever I chnaged the file in any way, it worked. It was only in its original state that I had a problem.

Hi Kristian, perhaps something wrong with your EXCEL ??? try it on another workplace to test We have seen here a lot of confusing in such solutions as the combination of Office97 and SymantecAntivirus had many problems to work properly

Dude i think your code is wrong… HAHA!! Try opening the file in something like UltraEdit and have a look at it? Are any of the columns when you do the import containing blanks?

quote:


perhaps something wrong with your EXCEL ??? try it on another workplace to test


Same result at the Client’s office, I’m afraid. Ade, we’ve checked the document thoroughly. If there was something odd in the line it should still be there after the cut & pasting anyway. I’ll ignore the slur about my code, OnTimer boy…

Kristian… Hey all those flashing labels and OnTimer triggers everywhere were only there to show you that when you had written incorrect code how annoying it would be to debug… Hence trying to get you to write the code correctly first time round… Clearly you didn’t as you are now calling me OnTimer boy so you must have had to correct your code a lot of times… Claiming it was my code that was incorrect is incorrect in itself… [B)]

Now now GP, I didn’t say it was incorrect. It did exactly what it was meant to do. It was just really, really, really annoying. And who says it was my code I was debugging? I can think of 7 developers off the top of my head who contributed to that system! Incidently, the conclusion to the problem originally posted here is that Excel is evil.

Dude… Are you missing the ‘Oracle’? He is our fountain of all knowledge… [:)]

quote:


Originally posted by Kbara
Incidently, the conclusion to the problem originally posted here is that Excel is evil.


I’m not sure to understand… I was thinking the csv was coming from Lotus Notes, not Excel. You also told that when you copy/paste in Excel, that solves the problem. So it looks to me that Excel is Good[^], not Evil [}:)] !!! Just to make sure, can you please confirm which program produces your csv file? It still looks to me that your original csv file is wrong. Did you try to compare the original csv with the csv (working) produced by Excel. To do this comparison, you’ll need an hexadecimal/text viewer like TextPad (http://www.textpad.com/)