Interview Questions

Tuesday, September 27, 2016

Print date on TXT file in AX

static void DataToTxtFile(Args _args)
{
    TextIO file;
    container line;
    InventTable invenTable;
    #define.filename('u:\\items.txt')
    #File
    ;
    file = new TextIO(#filename, #io_write);
    if (!file || file.status() != IO_Status::Ok)
    {
        throw error("File cannot be opened.");
    }
    file.outFieldDelimiter(';');// for semicolon seperator
    while select invenTable 
    {
        line = [invenTable.ItemId,invenTable.ItemName,invenTable.ItemGroupId];
        file.writeExp(line);
    }
}

No comments:

Post a Comment