X++ code to create CSV file in ax 2012.

    The TextIo,CommaIO  are the classes  used to create CSV files frequently.
    In this post i'm using CommaIO class to create CSV file. 
    #static void CreateCSVFileJob(Args _args)
    #{
    #    CommaIO                  file;  
    #    FileIOPermission       fileIOPermission;
    #    str                             filename;
    #    #File
    #    ;
    #    /*
    #    if(!fileNameLocation)
    #    {
    #        throw error('file location is empty');
    #    }
    #    */
    #    filename                 = @'D:\test.csv';
    #    fileIOPermission    = new FileIOPermission(fileName,"W");
    #    fileIOPermission.assert();
    #    file                          = new CommaIo(fileName,"W");
    #    //Header
    #    file.inFieldDelimiter(',');    
    #    file.write('CustomerNo','CustGroup','CustomerName');
    #    //Lines
    #    file.outFieldDelimiter(',');
    #    file.write('00101','10','vijay');
    #    file.write('00102','20','bhaskar');
    #    file   = null;
    #    CodeAccessPermission::revertAssert();
    # }

Thank You.


Comments

Popular posts from this blog

x++ code to add hyperlink to a field in D365FO

x++ code to get Vendor Email Address based on Purpose in Dynamics 365 for Operations

x++ code to get Customer Address based on purpose in ax 2012