Attachment Template Management
1 Waht is Attachment Template?
In SQLMessenger, the system generates attachment files for emails based on the Attachment Template you have configured. The system supports two types of attachment file type:
Dynamic Attachment File: You can use SQL statements to dynamically generate file content while the task is running. The system can convert SQL query results into Excel tables (.xlsx) or CSV files. It can also fill the SQL query results into the specified positions in the Excel sheet according to your designed Excel template.
Fixed-Content Attachment File: You can attach a Word document, PDF file, image file, or other file formats as an attachment to the email generated by the task.
You can click the "Add New" or "Manage" button on the right of the Attachments box to add or manage attachment templates for the task.
Click the "Add New" or "Manage" button to add or manage attachment templates
Click the "Add New" button on the right of the Attachments box to open the "Select An Attachment Type To Add" dialog box.
Add an attachment template
Create new attachment template(Dynamic Attachment File)
In this dialog box:
Template Name |
Set template name for the attachment template. |
Template disabled |
If you select this option, the attachment template will be disabled. Note: If the attachment template is disabled, it will not be processed during the next execution of this task, and the SQL statements within the attachment template will not be executed as well. |
Template Type |
Select the Template Type for the attactment template. |
File Format |
Select a converted file format for the attachment template. |
Display template content in the body of the email |
If the "Template Type" is "Convert to a spreadsheet table", after selecting this option, the system will display the content of the file generated by the attachment template in the email body after the task is completed. |
Rename File |
Here you can set the name for the attachment file generated after the task execution. You can use variables in the file name to generate dynamic file names. For example, if the "Rename File" is "Report(#@@Date#)", the name of the file generated by the task will become "Report(22_05_2023)". |
SQL Query List |
Here you can add the SQL query statement to be used for this attachment template, and configure the conversion method for the SQL query results. You can add multiple SQL statements in one attachment template and convert the query result of each statement to different location. |
Template Variables
You can create and use variables in the template. Template variables are only visible within the scope of this template. Using Variables in Tasks
Options
Don't send data files generated by this template |
If this option is selected, SQLMessenger will not send the generated Excel file as an email attachment. For example, if you only need to display the charts from the Excel file in the email body without sending the actual Excel file, you can check this option. |
If no data is retrieved from all SQL queries within this template, do not send the file generated by it |
After selecting this option, if none of the SQL statements in this template retrieve any data, the attachment generated by this template will not be sent. |
Convert the file generated by the template to PDF format(only HTML or Excel template) |
If the attachment template generates an HTML or Excel file, selecting this option will cause the system to convert the generated file to a PDF. |
Generate attachment files repeatedly according to the specified list(Loop Template) |
|
Merge the Excel attachment files generated by the template into one Excel file |
If this option is selected, the system will merge the Excel files generated by the Loop Template into a single Excel file. |
Automatically refresh the formulas in the attachment file after the file is generated (MS Excel support is required) |
If this option is selected, the system will automatically update the formulas in the generated files. This feature requires MS Excel 2010 or later to be installed on your computer. |
Compress the attachment file |
If this option is selected, the system will compress the files generated by the attachment template. Currently, ZIP format is supported for compression. You can add a password to the compressed file. |
SQLMessenger determines whether to convert the query results of SQL statements based on the Template Type. The system supports the following three Template Types:
Convert the query results into a spreadsheet file or a text file |
You can design the format of the spreadsheet yourself, and then the system will fill the data queried by SQL into the specified cells in the table. Convert the results of an SQL query into a simple Excel table |
HTML Report |
A report in HTML format can either be added to the body for display or sent as an attachment. |
Customize Spreadsheet Template |
You can design the format of the spreadsheet by yourself, and then the system will fill the data queried by SQL into the specified cells in the table. Custom Excel template |
Attachment Template Manage box
In this dialog box, you can click to adjust the display order of attachment templates.
You can use the toolbar on the right side of the attachment template list item to manage the attachment templates.
Click to open Attachment Template Properties dialog box to edit the attachment config. |
|
Click to preview the attachment template. |
|
|
Click to disable or enable the attachment template. Note: If the attachment template is disabled, it will not be processed during the next execution of this task, and the SQL statements within the attachment template will not be executed as well. |
Click to delete the attachment template. |