Friday, 13 February 2015

Export data to text file in ax2012

static void textFileExport(Args _args)
{
    TextIo  textIo;
    container line;
    Filename    filename;
   
    SiteTable    site;
   
    filename = @"C:\Users\Desktop\sitedetails.txt";
   
    textIo = new TextIo(filename, 'W');
    textIo.outFieldDelimiter(';');
   
    if(!textIo || textIo.status() != IO_Status::Ok)
    {
        error("File cannot be opened");
    }
   
    while select site
    {
        line = [site.SiteId, site.Name];
        textIo.writeExp(line);
    }
}

No comments:

Post a Comment