Using SQL Query in Templates

 

1 Using SQL Query in Templates
2 SQL Queries for Simple Table
3 SQL Queries for Customize Spreadsheet Template

1 Using SQL Query in Body Templates

You can use SQL queries in both the body template and the attachment template to retrieve information from your database and convert the retrieved information into different formats according to your requirements.

You can add multiple statements in a single template and set the execution order of the statements.

Add multiple statements in a single template

By clicking the SQL Statement column in the SQL statement list, you can edit the corresponding SQL statement.

Edit SQL Query

You can enter and modify the content of SQL statements in the SQL editor.

You can enter multiple query statements in the SQL editor, with the last statement used to retrieve the information to be displayed. You can also use variables in SQL statements to perform dynamic queries.

Using SQL Statements in Tasks

Enter multiple query statements in the SQL editor, using variables to perform dynamic queries

2 SQL Queries for Simple Table

You can convert the query results into a Simple Table and send it as an attachment, or display it in the body of the email.

SQL Query for Simple Table

You can follow these steps to enter SQL statements and convert the query results into a Simple Table:

(1) In the left SQL editor, enter SQL query statements, then click the "Test SQL" button. The system will execute the SQL query you entered and retrieve the field information returned by the SQL statements.

Enter and test SQL query

(2) Add the fields you want to display to the table in the right-hand table designer.

Add fields to the table

The Simple Table generated after task execution

Using Simple Tables

3 SQL Queries for Customize Spreadsheet Template

(1) In the left SQL editor, enter SQL query statements, then click the "Test SQL" button. The system will execute the SQL query you entered and retrieve the field information returned by the SQL statements.

Enter and test SQL query

(2) Set the mapping between SQL fields and data cells in the template on the right-hand side list.

Set the mapping between SQL fields and data cells

The table generated after task execution

Using Custom Excel Templates