Looping through lines in a .csv file?

thomast
Member Posts: 102
Hi Guys,
Does any of you know how I loop through a number of lines when importing a csv file? I'm using the file-variable for the import.
I need to csv file contains sales lines from another system which needs to go into a sales journal.
Thanks, Thomas
Does any of you know how I loop through a number of lines when importing a csv file? I'm using the file-variable for the import.
I need to csv file contains sales lines from another system which needs to go into a sales journal.
Thanks, Thomas
0
Comments
-
Use File.POS at the beginning of the loop and File.SEEK to get back to that point.
Why would you need such a thing? If you cannot process the lines in the order they appear in the csv I recommend to use a buffer table and a regular dataport to populate it.
I case you just wanted to know how to process a csv file without using a dataport, please use the Search the forum feature.0 -
Hi Vaprog,
Thanks for your reply!
Yes, I just need to know how to import a .csv file without using a dataport/xmlport. I searched the forums but were not able to find a thread. Can you (or anyone else) refer me to a good thread on this task?
Thanks, Thomas0 -
Well, you have to write a parser for it. It's not difficult but work.
Here's some code someone posted. I did not use it. Don't know how well it works for which scenario. It might give you a start.
Here's some info for when your lines might be too long or your fields might contain quoted record separators (CR LF, usually).
And here are some general remarks concerning the .csv format.0 -
Thank you vaprog!!!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions