# system.report.executeAndDistribute not saving file

**URL:** <https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [March 7, 2024, 12:55pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965 "2024-03-07T12:55:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Why\_Me](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Why\_Me](https://forum.inductiveautomation.com/u/Why_Me)\
**Post date:** [March 7, 2024, 12:55pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965/1 "2024-03-07T12:55:22Z")

</div>

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.

```auto
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")

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 7, 2024, 1:22pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965/2 "2024-03-07T13:22:36Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Why\_Me](https://avatars.discourse-cdn.com/v4/letter/w/b4bc9f/32.png) [@Why\_Me](https://forum.inductiveautomation.com/u/Why_Me)\
**Post date:** [March 7, 2024, 1:43pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965/3 "2024-03-07T13:43:51Z")

</div>

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')

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 7, 2024, 2:11pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute-not-saving-file/86965/4 "2024-03-07T14:11:34Z")

</div>

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 a`java.util.Date`, like you get from Ignition's `system.date.*` functions or expressions or datetime properties.)
