Database Pull

<< Click to Display Table of Contents >>

Navigation:  Message Retrieval Accounts > Reading/Receiving Messages >

Database Pull

The Database Pull option allows you to retrieve message text from a database which you can then execute Trigger actions against.


Click the Database Pull option on the Ribbon bar.




Click the Enable Database Pull option to enable Database Pull.


How It Works

At the Account pre-defined interval (for example, every 3 minutes), ThinkAutomation will read records from your database using a SQL 'SELECT' statement that you define. For each record returned it will pass the fields as the 'message text' to the Account Triggers. The first trigger that matches the trigger conditions will execute as with other message types. ThinkAutomation will then either delete the records from your database or set one of the fields to a value of your choice.


For example, suppose you need to automatically send an email to new customers that are added to a database. You could have ThinkAutomation check the 'Customers' table for new records at regular intervals. If a new record is found the message text could be set to the Customers record field values. Triggers could then send the customer an email. ThinkAutomation will then update the customer table to indicate that the customer is no longer new.



Enter the Database Connection String to your database or click the Build button to build the connection string using the Select Data Source dialog. Any data source can be used that is available on your computer. See Also: Connection Strings


You must then enter a SQL SELECT Statement (or VIEW or stored procedure) that will be executed against your database to return one or more records. You must include a WHERE clause so that previously read records will not be re-read each time.


Assign All Query Fields To Message Body


If this option is enabled then ThinkAutomation will set the message body text to all the fields returned from the query. The text will be set to the following format:


Fieldname: value

Fieldname: value



If you do not use this option then you can specify a single field to be assigned to the message body. In this case, just the field value will be assigned the message body on its own.


The Use Unique ID Field can be used to enter a field name from the SELECT statement that contains a unique value for the record in the database. If you enter a field here, ThinkAutomation will ensure that the same record is not processed twice. If no Unique ID is used then the same records could be processed multiple times if they are not filtered out using the WHERE clause (or deleted).


Select the Delete Processed Records From Source Database option if you want ThinkAutomation to delete each record returned from the SELECT statement from your database after it has processed them.


Alternatively you can Update Processed Records. In the Set Field entry, enter the database field to update. In the To Value entry, enter the value you want to set the field to. You can use %fieldname% replacements here.


Add a value to the Use Message Text Field option if you want to set the message body of the incoming record to a specific database field.


Performance Note: You should design your SELECT statement, VIEW or Stored Procedure, so that only the records you need to process are returned each time the database is checked, unless you know that only a few records will be returned each time.



ThinkAutomation © Parker Software 2016