# Email report.pdf

**URL:** <https://forum.inductiveautomation.com/t/email-report-pdf/10805>\
**Category:** General Discussion\
**Created:** [November 18, 2015, 3:18pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805 "2015-11-18T15:18:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![indenkleefj](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/indenkleefj/32/10961_2.png) [@indenkleefj](https://forum.inductiveautomation.com/u/indenkleefj)\
**Post date:** [November 18, 2015, 3:18pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805/1 "2015-11-18T15:18:02Z")

</div>

Hi

Ignition 7.8

I have a problem with sending a report through the mail. Every time the email is sent, it's being sent without any data in it. I am using this script.

```auto
to = event.source.parent.getComponent('E_Mailadres_Text Field').text
path = event.source.parent.getComponent('Report Viewer').reportPath
report = event.source.parent.getComponent('Report Viewer')
Bakkerij = report.Bakkerij
Opmerkingen = report.Opmerkingen
StartDate = report.StartDate
EndDate = report.EndDate 
system.report.executeAndDistribute(path = path, project = "Project",parameters = {"StartDate":StartDate, "EndDate":EndDate, "Bakkerij":Bakkerij, "Opmerkingen":Opmerkingen}, action = "email",
actionsettings = {"smtpServerName":"smtp", "from":"info@project.nl", "subject":"Leegdrukken Ringleiding Report", "attachmentName":"Leegdruk Ringleiding.pdf", "fileType":"pdf", "to":[to]})

```

I get this Error:

> Time Logger Message  
> ERROR 16:13:25 Data [projectName=Project,reportPath=Leegdruk Ringleiding] Error gathering data for report   
> com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported.

First I did use a different script with the function getBytes PDF but this function doesn't longer exists.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [November 18, 2015, 3:29pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805/2 "2015-11-18T15:29:31Z")

</div>

> [@](#):
>
> ERROR 16:13:25 Data [projectName=ABMauri,reportPath=Leegdruk Ringleiding] Error gathering data for report com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported.

The key to your problem is in the error you posted. Your report is trying to get some data from a SQL Server database, and the query is failing. Check the data sources you defined in your report to see where that problem might be.

> [@](#):
>
> First I use a different script with getBytes PDF to this function does not or no longer exists?

Right, getBytesPDF no longer exists with new reports (however it continues to work with your old reports). For new reports, you can achieve the same thing with system.report.execute() and specify a PDF format. However, for that to work you'll need to resolve your sql error above.

---

<div class="post-metadata">

**Author:** ![indenkleefj](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/indenkleefj/32/10961_2.png) [@indenkleefj](https://forum.inductiveautomation.com/u/indenkleefj)\
**Post date:** [November 18, 2015, 3:41pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805/3 "2015-11-18T15:41:10Z")

</div>

I use SQL Query type in the data source of the report. Here's the query:

> SELECT Leegdruk.BakkerNr,  
> Leegdruk.Leegdruk\_start,  
> Leegdruk.Leegdruk\_stop,  
> Leegdruk.Leegdruk\_TankNummer,  
> Leegdruk.Leegdruk\_water  
> FROM Leegdruk  
> WHERE Leegdruk.BakkerNr = ?  
> AND Leegdruk.Leegdruk\_start \>= ? AND Leegdruk.Leegdruk\_stop \<= ?

1 ? = BakkerNr  
2 ? = StartDate  
3 ? = EndDate

It seems that the report StartDate and EndDate parameters don't update.

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [November 18, 2015, 4:54pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805/4 "2015-11-18T16:54:32Z")

</div>

Kathy and I were just discussing this issue and it seems similar to an error we’ve seen in Windows when using older versions of the SQLServer JDBC driver (including the default 4.0 version included with Ignition if I recall correctly). I suggest installing the newest 4.x SQLServer JDBC driver. You can install a new driver in the Gatewaly-\>Databases webpage.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 7, 2021, 8:31pm UTC](https://forum.inductiveautomation.com/t/email-report-pdf/10805/5 "2021-04-07T20:31:07Z")

</div>

Split this topic on April 7, 2021, 8:31pm UTC

A post was split to a new topic: [Unable to send report via email](https://forum.inductiveautomation.com/t/unable-to-send-report-via-email/45364)
