import variable column count csv with xmlport

BartD
Member Posts: 3
Hi there,
An example of the content of the csv file below.
1.;9.;8.;16.;;13.;;38.;;;15.;3.;30.;31.;;;;;;;;;42.;92.;;;;;;;39.
###;ABCDEF;ABCDEF;DOLIXMR16, round , white, max. 35W;;32,9;AAA;50;;;STK;1/11/2015;05.02;1;;;;;;;;;290;320;;;;;;;4024163080323
The first line is a header: a number that indicates which kind of variable it should be in the next rows. For example: 39. says us that this column contains the EAN-code. I import only the columns with a number into this row, empty fields are skipped.
Is there a way to import the csv with XMLport and select the elements depending on the value in the first row. Another good option is in Import::OnBeforeInsertRecord() procedure add the elements into an array.
Can I use the fieldindex or recordref function on xmlport? Reading the whole row as text can generate an text overflow, and it's "dirty coded".
How to select each xmlport element without 'insert' it?
A temporary table is also an option, but it could happen thet there are 135 columns in the csv file. Does that mean i have to add 135 text elements - I had to add these in different tables?
See attachment: settings to import csv
Thanks in advance
Best regards,
BartD
An example of the content of the csv file below.
1.;9.;8.;16.;;13.;;38.;;;15.;3.;30.;31.;;;;;;;;;42.;92.;;;;;;;39.
###;ABCDEF;ABCDEF;DOLIXMR16, round , white, max. 35W;;32,9;AAA;50;;;STK;1/11/2015;05.02;1;;;;;;;;;290;320;;;;;;;4024163080323
The first line is a header: a number that indicates which kind of variable it should be in the next rows. For example: 39. says us that this column contains the EAN-code. I import only the columns with a number into this row, empty fields are skipped.
Is there a way to import the csv with XMLport and select the elements depending on the value in the first row. Another good option is in Import::OnBeforeInsertRecord() procedure add the elements into an array.
Can I use the fieldindex or recordref function on xmlport? Reading the whole row as text can generate an text overflow, and it's "dirty coded".
How to select each xmlport element without 'insert' it?
A temporary table is also an option, but it could happen thet there are 135 columns in the csv file. Does that mean i have to add 135 text elements - I had to add these in different tables?
See attachment: settings to import csv
Thanks in advance
Best regards,
BartD
0
Comments
-
Hello,
A solution is read the info from xml and use a codeunit working with .Net functions, using Dotnet type Variables like XMLDocumentreader. You set the column names in the header or the first row. The next rows filling these variables into the table you want to update.
Example code is coming.
Greetnings0
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