Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Exporting RTC report to CSV File.

Posted on by 2,976

Hello,

How can we Export specific report into CSV format output file in specific location. The CSV File should be in specific format that matches the Layout of the report.

Thank you.

*This post is locked for comments

  • troyh1968 Profile Picture
    troyh1968 45 on at
    RE: Exporting RTC report to CSV File.

    I know this is a very old post but I am trying to do what your reply is explaining however I am VERY new to coding. I am trying to out put a .csv file from a report. The reason I am doing it this way is because this is something that Accounting will do a few times a week and they do not have access to run XMLPorts in the development environment. Is this something that you can help me with?

    Thank you in advance.

    Troy

  • keoma Profile Picture
    keoma 32,675 on at
    RE: Exporting RTC report to CSV File.

    you get a similar result, when you create a xmlport with dataitems according the report and output format csv.

  • Verified answer
    Rabin Profile Picture
    Rabin 2,976 on at
    RE: Exporting RTC report to CSV File.

    I achieved this by copying each record generated inside report into a text[1024] variable and then transferring data into a file which was later used for creating a CSV file... 

    CODE:

    ltx_Line :=  ltx_Line+ ltx_CRLF + "Check No." + ','+ Description+ ','  +FORMAT(Amount)...;

    where ltx_Line holds the value of each record and later i transferred the value accumulated to a file which can be copied to a CSV file create by code:

    //-------------

    lfi_ExportFile.CREATE('C:\MyNewFolder\test.csv'); //Create a file in specified destination

    lfi_ExportFile.WRITE(ltx_Line);; // This will transfer data from text variable to the file

    //-----------

    Alternative to keep all file in a same text: I can directly export to file everytime, this will prevent from error message of Data Overflow..

    lfi_ExportFile.WRITE(ltx_Line);  //This can be used inside a loop-->every line will be copied to ltx_Line & get copied to CSV file instead of storing multiple line

    lfi_ExportFile.CLOSE; // This will close the file

    //----------

    In order to create a new line i used ltx_CRLF:

    ltx_CRLF := '';

    ltx_CRLF[1] := 13;

    ltx_CRLF[2] := 10;
    //------
    The same pattern can be used to export Data from a Table to CSV file as well... and it works in both classic and RTC reports...
    Thanks...

  • keoma Profile Picture
    keoma 32,675 on at
    RE: Exporting RTC report to CSV File.

    export the report as excel report e.g. using saveasexcel, then convert to csv (in excel or programmatically using .net). so you get a csv file with layout that matches the report layout.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans