system.report.executeAndDistribute not saving file

I cant seem to get this to actually save the PDF, is there anything obviously wrong here? Ive followed the documentation available. Ive tried changing file path, project names as much as i could and no luck so far.

reportFileName=system.tag.readBlocking(["[default]Reports/ReportPath"])[0].value

settings = {"path":"C:\\Ignition Reports", "fileName":"%s"%reportFileName, "format":"pdf"}
system.report.executeAndDistribute(path="Test_Report", project="PTS-WAS-H1", action="save", actionSettings=settings)

system.nav.openWindow("Test_Report")

Reports are generated on the gateway, and that is where an "distribute" file save action will occur.

In Vision, if you wish to save local to the client, use system.report.execute to directly return the PDF bytes, and then save those bytes to a file (in a client side script).

1 Like

I had a look on my gateway server and looks like the issue might be in running the report alhtough it shows on the client report viewer its maybe not actually attempting to save due to this error..

could this be the case?

if so what is the error meaning?

java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Date (java.lang.String and java.util.Date are in module java.base of loader 'bootstrap')

It means you are trying to pass a string that looks like a date as if it is a date. Ignition doesn't work that way. Pass an actual date object. (Not a python date object, but ajava.util.Date, like you get from Ignition's system.date.* functions or expressions or datetime properties.)

1 Like