Sunday, July 31, 2011

Writing date to Txt file

Here is a solution for writing a date to Text file from Dynamics Ax.
Before running this code a physical file should be created as specified in the code('u:\\items.txt')

static void DataToTxtFile(Args _args)
    TextIO file;
    container line;
    InventTable invenTable;
    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];

No comments:

Post a Comment