Saving "Reporting" document save as CSV file and automatically to a specific folder?

Hi all,
I’ve made use of the reporting module on ignition 8.1. At the moment I’m opening up vision and right clicking to save it as a PDF and locating the folder myself.

I’m wondering would it be possible to set up scheduled reporting which saves to a specific folder?
Also, looking at a previos thread, would this code still work to convert the data to appear as a CSV file?

csvBytes = system.report.executeReport(path="My Path", project="MyProject", parameters={}, fileType="csv")

According to the documentation, yes. Just keep in mind that this only gives you the bytes. You will still need to do something with them.

system.report.executeAndDistribute() can also save the file for you in one go.

For both options, remember that the gateway needs access to the file path.

1 Like

Remember when you use system.report.* functions, you need to trigger the execution somehow. If you want that automated, you can use a timer script, a tag change script, or, as of 8.1.6, the new scheduled script which lets you set up custom execution schedules.

However, there’s also a built in scheduled execution for reports. This can save to a folder you specify, and that folder and file name can even be dynamic. Check out the docs for an example of how to do this.

Is it possible to email and save a report with one execution in a Run Script Action ?

For now I use system.report.executeReport() to email it then system.report.executeAndDistribute() to save it to my mounted folder.
For me, this way execute the report twice. I would like to execute once for all to improve performance.

Sounds like what we need is a way to use system.file.writeFile() to write binary data. Then you could write the bytes you receive from executeReport(). I'll make a feature request for this. [IGN-6904]

Well it would sure help if I could correct read our own documentation. :woman_facepalming:

system.file.writeFile() does in fact accept binary data. So use executeReport() once, then use the bytes returned for both your email and your file save.