Dynamics AX - AX Table to CSV File via X++

static void ShyamTabletoCSVFile(Args _args)
{
 CommaTextIo file;
container line;
CustTable custTable;
#define.filename(@'C:\Users\shyamsundar.kanna\Documents\Testing\TestFile.csv')
#File
file = new CommaTextIo(#filename, #io_write);
if (!file || file.status() != IO_Status::Ok)
{
throw error("File cannot be opened.");
}
while select * from custTable
{
line = [custTable.AccountNum ,custTable.Name()];
file.writeExp(line);
}
info(strFmt("File %1 created in specified folder.", #filename));
}

Comments

Post a Comment