Programmatically Download a Report

Posted by: bolsen on 15 June 2023, 12:28 am EST

    • Post Options:
    • Link

    Posted 15 June 2023, 12:28 am EST

    Is there a way to programmatically download a report or create a blob?

    I have a situation a user needs to click a button and it returns all available reports without using the viewer.

  • Posted 19 June 2023, 3:20 pm EST

    Hi Brett,

    ActiveReportsJS reports are stored as JSON object with ‘rdlx-json’ extension, if your requirement is only to fetch all the reports from a directory you may iterate over all the reports in that directory to get all the available reports.

    However, if you need to get the current report which is loaded in the designer you can use the ‘Designer.getReport()’ method which returns a Promise object of the current report in the designer. Which you can convert into a blob or get its ‘definition’ property to store as a new ‘rdlx-json’ report.

    Please find attached a sample implementing the ‘getReport()’ method. You may learn more about the same here ReportDesigner API.

    Regards,

    Anand

    Designer.zip

  • Posted 19 June 2023, 5:16 pm EST

    Is there a way of doing this for the report viewer once the report has been generated.

    I want the generated reports but without opening the report viewer, i want to generate the report and download it to a pdf or excel file all in the background.

  • Posted 20 June 2023, 8:04 pm EST

    Hi Brett,

    Yes, you can load your Report in a PageReport object, run the same and download it to a PDF or Excel programmatically in the background. You may learn more about the same here: Printing and exporting the report output.

    Please find attached a sample implementing the same. (To run the sample run ‘npm i’ to install all the required packages after which run ‘npm start’ and open ‘localhost:5000’)

    Regards,

    Anand

    Sample

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels