Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

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

Posted on by 562

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

  • TonyAx Profile Picture
    TonyAx 562 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    I will try and let you know .

  • kvnkk Profile Picture
    kvnkk 796 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    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

  • TonyAx Profile Picture
    TonyAx 562 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    For testing purpose,I given for Both.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Export the data to .CSV file using batch process in ax 2012

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

  • TonyAx Profile Picture
    TonyAx 562 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    Yes I given full permission to that folder .

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Export the data to .CSV file using batch process in ax 2012

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

  • TonyAx Profile Picture
    TonyAx 562 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    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();

       }

    }

  • kvnkk Profile Picture
    kvnkk 796 on at
    RE: Export the data to .CSV file using batch process in ax 2012

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

  • TonyAx Profile Picture
    TonyAx 562 on at
    RE: Export the data to .CSV file using batch process in ax 2012

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

    CIL without error.

    /Tony

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Export the data to .CSV file using batch process in ax 2012

    Could you share your code?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans