# Automating Reports

**URL:** <https://forum.inductiveautomation.com/t/automating-reports/3695>\
**Category:** Ignition\
**Created:** [December 2, 2011, 11:06pm UTC](https://forum.inductiveautomation.com/t/automating-reports/3695 "2011-12-02T23:06:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfbuehler](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@rfbuehler](https://forum.inductiveautomation.com/u/rfbuehler)\
**Post date:** [December 2, 2011, 11:06pm UTC](https://forum.inductiveautomation.com/t/automating-reports/3695/1 "2011-12-02T23:06:57Z")

</div>

I have several reports created on windows using the Report Designer and all works good.

Is there a good way to automate these reports and email a pdf of them out at a specific time such as 12:05 email out the daily report.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [December 2, 2011, 11:23pm UTC](https://forum.inductiveautomation.com/t/automating-reports/3695/2 "2011-12-02T23:23:25Z")

</div>

There is as long as you keep a client open. Since the report is part of the client you have to have a client open. Typically, people will open a dedicated client on the server machine that just has one report and at a specific time it is emailed or printed or saved.

So let’s say you have a report on a window. The report can be visible or not. Here are the steps to email it at a specific time:

1. Add a dynamic property on the Root Container (right click on root container and select customizers \> dynamic properties) called emailReport that is a boolean.

2. Bind the emailReport property to the following expression:`dateFormat(now(5000), "HH:mm") = "12:05"`

3. Add the following propertyChange script to the Root Container (right click on root container and select event handlers \> property change):`if event.propertyName == "emailReport":
 if event.newValue == 1:
 	report = event.source.getComponent('Report Viewer')
 	bytesPDF = report.getBytesPDF()
 	system.net.sendEmail("mail.smtpserver.com", "reports@ignition.com", "Subject", "Body", 0, ["to@someaddress.com"], ["report.pdf"], [bytesPDF], 60000*5, "Username", "Password")`You just have to make sure the report bindings are polling so they will be updated when the script runs. This is just a starting point. Let us know if you have questions.
