Showing posts with label Text file. Show all posts
Showing posts with label Text file. Show all posts

Friday, July 3, 2020

Data Export to Text file from Ax 2012 using X++

Hi guys, Today we see how data is exported to Text file(Notepad).

Write the below code in job. Do changes as per your requirement.

static void export_data(Args _args)
{
    #File
    CommaTextIo commaTextIo;
    FileIOPermission permission;
    Testing testing;    //my table
    str fileName = @"D:\Ax\test.txt"; // file path

    permission = new FileIOPermission(fileName,#io_write);
    permission.assert();

    commaTextIo = new CommaTextIo(fileName,#io_write);
    while select testing
    {
        commaTextIo.write(testing.AccountNum,testing.AccountName,enum2str(testing.PlayerType));
    }

    CodeAccessPermission::revertAssert();
    info("success");

Output:
        
                InfoLog



            Notepad


Keep Daxing !!

Just check below links for Export and Import process of Xml