Example using Local DB Select action

Assumptions

The following is assumed:

  • You know how to create a trigger and add actions to that trigger using the Canvas Editor. For more information on the Canvas Editor, see Using the Canvas Editor.
  • You are familiar with Structured Query Language (SQL) and relational databases.

Retrieving data from a local database table using Local DB Select

This example describes a trigger that when executed retrieves rows from a local database table using the Local DB Select action. The following shows a portion of the sample trigger:

The sample trigger has a Local DB Select action and Log Message action.

Using the Local DB Select action, each column can be mapped to a variable (including trigger variables and device variables).

In order to process the data retrieved, the Local DB Select action must iterate through the rows returned by the SQL Select operation. You can process the column values for each row using the Next Row option on the Local DB Select action Routing tab. The last action on the Next Row route must be routed to the Local DB Select action.

For this example, there is only one action to execute from the Next Row route. The Log Message action Success route is returning to the Local DB Select action.

When there are no more rows to process and no errors encountered, the logic flow from the Local DB Select action will follow the Success route. The number of times the Next Row route will be executed is given by the values returned in Rows Selected. The Row Index keeps track of the current row being processed.

Related topics

Local Database

Transaction