Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading a comma separated values (csv) file in dynamics ax

Tags:

axapta

x++

How do you open and parse a csv file in dynamics ax?

like image 850
James Moore Avatar asked Dec 08 '10 18:12

James Moore


People also ask

How do I read a comma in a CSV file?

Using the "From Text" feature in Excel Select the CSV file that has the data clustered into one column. Select Delimited, then make sure the File Origin is Unicode UTF-8. Select Comma (this is Affinity's default list separator). The preview will show the columns being separated.

How do you handle commas in data when importing a CSV file?

Re: Handling 'comma' in the data while writing to a CSV. So for data fields that contain a comma, you should just be able to wrap them in a double quote. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.

How a CSV file is separated?

Delimited text files (.txt), in which the TAB character (ASCII character code 009) typically separates each field of text. Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text.

What is field delimiter in CSV?

with a character such as a comma (,). This character is called the field separator or delimiter. When the field separator (delimiter) is a comma, the file is in comma-separated (CSV) or comma-delimited format. Another popular delimiter is the tab.


1 Answers

static void TestCommaTextIO(Args _args)
{
    #File
    CommaTextIo        commaTextIo;
    FileIOPermission   permission;
    container          containFromRead;
    int                x;
    int                cols;
    ;
    permission = new FileIOPermission('c:\\junk\\mycsv.csv',#io_read);
    permission.assert();

    commaTextIo = new CommaTextIO('c:\\junk\\mycsv.csv','R');

    containFromRead = commaTextIo.read();
    While(containFromRead)
    {
        cols = conLen(containFromRead);
        for(x=1;x<=cols;x++)
        {
            print conpeek(containFromRead,x);
        }
        containFromRead = commaTextIo.read();
    }
    pause;
    commaTextIo = null;
}
like image 147
James Moore Avatar answered Sep 28 '22 12:09

James Moore