Options

import variable column count csv with xmlport

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

Comments

  • Options
    BartDBartD Member Posts: 3
    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.

    Greetnings
Sign In or Register to comment.