web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics 365 Vs Me / How export data to csv file...

How export data to csv file in Ax 2009

Deepak Agarwal Profile Picture Deepak Agarwal 8,585

How export data to csv file in Ax 2009

Hi friends ,

   Today we will learn how to exporting our  data from Ax 2009 to csv file format. The programming is done through X++ code. Change the code as per your requirements. Now we will have a simple example of writing the invent table to the csv file

public static void main(Args _args)
{
    Commaio file;
    container line;
    InventTable inventTable;
    #define.filename("C:\\dpk_Items.csv")
    #File

    ;
    file = new Commaio(#filename , #io_write); or  file = new Commaio(#filename , 'W');
    //file.outFieldDelimiter(';');
    if( !file || file.status() != IO_Status::Ok)
    {
        throw error("File Cannot be opened");
    }
    while select inventTable
    {
        line = [inventTable.ItemId,inventTable.ItemName];
        file.writeExp(line);

    }


}
  As per this you can save the document in any format such as doc,txt,xls only.

This was originally posted here.

Comments

*This post is locked for comments