Exporting Data from AX to text file

static void DemoExporttoExcel(Args _args)
{
   TextIO file;

    container line;

   InventTable                    inventTable;
   #File
   #define.filename('C:\\Data.csv')
   ;
   //Filename

   file = new TextIO(#fileName, #io_write);

   file.outFieldDelimiter(';');// for semicolon seperator
    if (!file || file.status() != IO_Status::Ok)
    {

    throw error("File cannot be opened.");

    }

   while select inventTable
   {

      line = [inventTable.itemId];

        file.writeExp(line);
   }

  }

Comments

Popular posts from this blog

D365: SSRS Report Development/ Customization

D365: X++ code to add custom lookup on worker to show specific workers team workers only

Error message when you log on to a Microsoft Dynamics AX 4.0 client: "You are not a recognized user of Microsoft Dynamics AX"