Email report.pdf

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.

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.

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.

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.

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.

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.

A post was split to a new topic: Unable to send report via email