deleting 1st Row before inporting data from CSV file

brijleobrijleo Member Posts: 70
Hi,

I am importing data form .csv file, but before importing data i have delete 1st row which contain header row automatically.


thank!

Comments

  • kapamaroukapamarou Member Posts: 1,152
    I suppose that you could use a counter and do a CurrDataport.SKIP but the problem is that all your headers are "TEXT" and you'll get errors when the field is of different type. I wouldn't do it if I were you, but if you really need it, declare Text Variables for all your columns and do a skip on the first row. Then you'll need to manually EVALUATE / VALIDATE the values in the record fields...
  • kinekine Member Posts: 12,562
    Or you can use
    CurrFile.READ(MyVariable);
    

    In OnPreDataItem or OnPreDataport when mode is Import to skip the first line (it will read the line and the import will continue on next line). 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,110
    kine wrote:
    Or you can use
    CurrFile.READ(MyVariable);
    

    In OnPreDataItem or OnPreDataport when mode is Import to skip the first line (it will read the line and the import will continue on next line). 8)
    And "MyVariable" is of type Text1024.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • SavatageSavatage Member Posts: 7,142
    Here's an explanation that I used from Tips N Trick Forum.

    It allows you to skip the first line (or multiple lines if needed)
    viewtopic.php?f=5&t=10564
Sign In or Register to comment.