How to save or print Report using Perspective module?

I am new to perspective and ignition. I am facing problem with saving report on button click. I tried all the different ways given in forum and YouTube. I created a report named “ExpenseReport” and a view with pdf viewer and a button and in button onclick event I wrote the following code:

settings = {‘path’:‘C:\Reports’, ‘fileName’:‘ExpenseReport.pdf’, ‘format’:‘pfd’}
system.report.executeAndDistribute(path=‘ExpenseReport’, project=‘TimeSheetV3’, action=‘save’, actionSettings=settings)

I don’t know where I am doing wrong.

I am using Ignition 8.0.7

Thank You.

executeAndDistribute will save the report on the gateway machine.

If you want to download the report locally on whatever Perspective session you’re using, you need two functions - system.report.execute and system.perspective.download. system.report.execute can return the binary data that constitutes your report, in whatever format you specify - then system.perspective.download allows you to send that data to the front-end and actually download a local file.

https://docs.inductiveautomation.com/display/DOC80/system.perspective.download

4 Likes

@ptchanchal, In the upcoming 8.0.9 release, you'll also have a Report Viewer component that provides downloading/printing of reports in addition to the embedded report that you can interact with in a client session. It's available now in a nightly release if you'd like to play around with it.

1 Like