cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Can we automate report creation and send it as email attachment in ThingWorx?

AP_10483126
9-Granite

Can we automate report creation and send it as email attachment in ThingWorx?

Would like to generate a report based on the inputs from different sensors and then send this report as an email attachment.

5 REPLIES 5

The Mail Extension (PTC supported) has a service called "SendMessageWithAttachment" which allows you to send an email with attachment.

https://support.ptc.com/help/thingworx/platform/r9/en/index.html#page/ThingWorx/Help/Extensibility/Mail.html

What are your requirements around the report (file format etc)? 

A Pdf format or excel with the dataset should do.

can this be automated?

Hi @AP_10483126 

 

PTC does not have a PDF extension, however IQNOX.com who is a PTC partner maintains and supports the CSV Parser extension. This is a free extension but you will have to create an account on their site. 

The report can be automated through the use of the Scheduler and Subscription.

 

Regards,
Arshad

AP,

 

Our company is also a PTC partner; we have been sending html-formatted reports for several years now, and it is quite easy once you have ThingWorx set up with an Email Thing.  For all of the following, do NOT include the "<", ">" brackets.  Replace the contents with YOUR information!

 

STEP 1:  Set up a Notification Handler and include a service to handle the sending of an email.  The output of the service is a STRING:

See attached file "Stripped down Notification Handler.txt"

STEP 2:

Write your database thing service.  Our reports use stored procedures; run the DB Thing service as a QUERY, not a command!  This is where we query the data and format the HTML output.  If you're pulling data from sensors, just send the params to the stored proc instead.  View the attached file "Stripped Down Formatted Email Stored Procedure.txt"

 

Hope this helps some.  We also have javascript that allows us to export formatted data and send it as an email.  However, it isn't nearly as robust and it can't handle much data.  I've emailed up to 500 rows of data via the stored procedure with no problems.  You can also set up a scheduler to fire the handler on a scheduled basis.  So if you are storing data from sensors in a database, this is the easy way to send it.

 

 

Top Tags