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);
}
}
{
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
Post a Comment