Using Data Extraction Code

Using Data Extraction Code

 

1 What is Data Extraction Code?

To facilitate contacts in the address book to actively initiate data extraction requests when they need, SQLMessenger provides a Data Extraction Code function. Contacts can send an email with "Data Extraction Code" to the configured email account in SQLMessenger. After the system receives this email, it will execute the corresponding task and reply to the requesting contact with the execution result (such as a report email).

The processing procedure of the Data Extraction Code

In order to be able to receive data extraction requests, you need to select the "Allow accepting data extraction requests" option for the email account in the Email Account Manager.

Select the "Allow accepting data extraction requests" option for the email account in the Email Account Manager

Note:

This feature requires the computer with SQLMessenger installed to be running continuously.

When SQLMessenger receives a data extraction request, it will check if the sender's email address has the permission to use the data extraction code, and only send the task execution result back to the contact's email address in the address book, not to any other addresses.

Email Account Management

2 Generate Data Extraction Code

The Data Extraction Code is a unique string randomly generated by the system, approximately 44 characters long. The system determines which task to be executed based on the data extraction code.

You can generate a data extraction code for a task in the task configuration window.

Generate Data Extraction Code for a task in the task configuration window

Tips: When a new data extraction code is generated, the old data extraction code for this task will become invalid. The system will ignore emails containing the old data extraction code and will not perform any actions.

3 Modify The Query Conditions Of The Task

To query the report data for a corresponding contact, you may need to use the contact's email address that initiated the data extraction request in your query statement. You can use the @@InitiatorEmailAddr variable to obtain this email address.

@@InitiatorEmailAddr is a system variable. You can use this variable to obtain the email address of the person who initiated this task instance. If the task instance is started by the administrator in the SQLMessenger Console, "@@InitiatorEmailAddr" returns the administrator's email address. If the task instance is started by a data extraction email, "@@InitiatorEmailAddr" returns the email address of the contact who sent the request. In other cases, "@@InitiatorEmailAddr" returns an empty string.

For example, you might modify your SQL query to look like this:

SELECT *
FROM   sales_stat
WHERE  manager_mail_addr = #[@@initiatoremailaddr]#
       AND stat_month BETWEEN 202401 AND 202406
ORDER  BY stat_month; 

When executing this SQL statement, the system will pass the contact's email address as a parameter to the SQL statement.

The system pass the contact's email address as a parameter to the SQL statement

4 Add Contacts Who Can Use The Data Extraction Code

You can add contacts to the data extraction code's contact list in the task configuration window. These contacts will have the permission to use this data extraction code from their email address to invoke the task and obtain the task's execution result.

Add Contacts to the Data Extraction Code's contact list

5 Send Data Extraction Code To Contacts

After the data extraction code is generated, you can send the data extraction code to the specified contacts.

Send Data Extraction Code email - 1

Send Data Extraction Code email - 2

The system sends a data extraction code email to the contact, which includes the usage instructions for this data extraction code.

Data Extraction Code email

6 Query The Processing Record Of The Data Extraction Code

You can query the processing status of data extraction emails in the inbox of the Email Manager.

Inbox query

7 Points For Attention When Using Data Extraction Codes

When using data extraction codes, please pay attention to the following issues:

(1) When using data extraction codes, it is necessary to regularly clean up the inbox of the email account that receives the data extraction codes by deleting processed emails to improve email processing speed.

You can select the "Delete received data extraction email from the server" option in the email account manager, and the system will automatically delete the received data extraction requests.

Select the "Delete received data extraction email from the server" option

(2) When contacts send requests, they should include the data extraction code in the subject or body of the email. Otherwise, the system will not be able to determine which task should be executed. It is recommended to write the data extraction code in the email subject, and the email body can be left empty.

(3) You should configure and use data extraction codes within your company's internal email system and avoid using them in an internet environment to ensure data security.

Last updated on June 05, 2024