deleting 1st Row before inporting data from CSV file

brijleo
brijleo 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

  • kapamarou
    kapamarou 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...
  • kine
    kine 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.
  • kriki
    kriki Member, Moderator Posts: 9,121
    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!


  • Savatage
    Savatage 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