Options

Dataport does not read last line of csv file

livingdolllivingdoll Member Posts: 45
Hi there,

I created a dataport that reads data from a csv file that was created with Excel. The dataport reads every line correctly, except for the very last line! It skips it every time. Does anyone have a clue? Could it have something to do with the way excel stores csv files?

Best regards,
LD

Comments

  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Do you use Dataport Fields or do you use code in a certain trigger to import the data?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    livingdolllivingdoll Member Posts: 45
    I don't directly write to the table. The read data is manipulated first before I write it to the table with code.

    The dataport doesn't even get to the last line, because when I insert a MESSAGE in the onbeforeimport trigger (to test if the line is read) the displayed line is not the last line but the one before that.
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I supposed that you use the OnBeforeImportRecord trigger. As you can see in the online help this trigger is executed before the next record is read from the external (import) file. Thus you will inserted the data of the last (above) text line, because the system doesn't even read the new line. Move your code to the OnAfterImportRecord Trigger! This trigger is executed after the record is read from the file.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    livingdolllivingdoll Member Posts: 45
    You are brilliant :-) I completely overlooked if I was working in the correct trigger! Thx!
  • Options
    Ann-KatrineAnn-Katrine Member Posts: 5
    Hi,
    I am having exactly the same problem - except from the fact, that my code for manipulating and inserting the data in the table the data is already in the OnBeforeImportRecord trigger.

    The last line of the csv file is not read by the dataport. ](*,)
  • Options
    Ann-KatrineAnn-Katrine Member Posts: 5
    Sorry: I misread the answer as if the code is supposed to be in the OnBeforeImportRecord trigger. :oops:

    I moved my code to the OnAfterImportRecord, and now it reads alle the lines and I do not get an empty line at the beginning. #-o
Sign In or Register to comment.