web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Export the data to .CSV file using batch process in ax 2012

(0) ShareShare
ReportReport
Posted on by 570

Hi All,

 I tried blow link for export the data from ax to .CSV file with out batch process  its working good  .

https://mycsharpdeveloper.wordpress.com/2016/04/28/how-to-export-data-to-csv-using-x/

while i try to add the batch process its  not working showing some error.Please give some idea to reslove

CSV-erro.PNG

Thanks

Tony

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Usually there are 2 possible issues here:

    1) Batch is executed on the server and if you specify file path that does not exist it wont work, so use shared folder and confirm that AOS\batch user has full access to it.

    2) Batch job is executed under CIL, so confirm that CIL is built without any errors. 

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Could you share your code?

  • TonyAx Profile Picture
    570 on at

    Thanks for quick reply , I tried your points but there is no luck still same problem .

    CIL without error.

    /Tony

  • kvnkk Profile Picture
    800 on at

    Can you share your code? So that will get a chance to look in to issue.

  • TonyAx Profile Picture
    570 on at

    class RunBaseDemo extends RunBaseBatch

    {

    }

    client server static ClassDescription description()

    {

       return "Mark on-hold";

    }

    public void run()

    {

      CommaIo io;

       str TodayDate;

       str strfilename;

       str fileName;

       TransDate       _transDate;

      _transDate  =  systemDateGet();

      strfilename  = "QL Item Update.csv";

        fileName    =  @"C:\Sample\";

       startTime   = str2time("12:00:01 am");     //GMT, NOT user time zone - this is how stored in the table

       endTime     = str2time("11:59:59 pm");

       rangeStart = DateTimeUtil::newDateTime(_transDate,startTime);

       rangeEnd   = DateTimeUtil::newDateTime(_transDate,endTime);

        io = new CommaIo(strFmt("%1//%2", filename, strfilename), 'W');

        io.outFieldDelimiter(",");

        io.outRecordDelimiter('\r\n');

        io.write('Item Number','Sell UPC','Description','Size','Color');

       while  select inventTable where inventTable.createdDateTime >= rangeStart &&

                                   inventTable.createdDateTime <= rangeEnd

    {

    io.write(inventTable.ItemId,retailInventTable.getDefaultBarcode(),ecoResProductTranslation.Name,inventTable.StandardInventSizeId));

    }

    info(strFmt("File %1 created in specified folder.", fileName + strfilename));

    }

    static void main(Args _args)

    {

       RunBaseDemo objClass = new RunBaseDemo();

       //prompt for runbase framework dialog

       if (objClass.prompt())

       {

          //run the process

          objClass.run();

       }

    }

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Do you have folder C:\Sample\ in your AOS server that is running the batch?

  • TonyAx Profile Picture
    570 on at

    Yes I given full permission to that folder .

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Full permission to whom? Your account? AOS Service account?

  • TonyAx Profile Picture
    570 on at

    For testing purpose,I given for Both.

  • kvnkk Profile Picture
    800 on at

    I have tested the code which was shared by you and its working in batch and as well as in client side. Only change is destination I have given network shareholder with full permissions. plz validate same

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans