Create an Action to Run a Query (Classic)

This topic describes how to create an action to run a query.

Before you begin

Create a trigger based on an entity condition or a device condition.

About this task

You can also create an action to:

Procedure

  1. Access the event for which you want to create an action.
  2. Select Run a Query.
    The Run a Query section appears.

  3. Enter or select values as described in the following table.
    Field Name Description
    Query Select the query that you want to run when the event is triggered. If the query that you have selected requires input values, the corresponding fields appear. If that happens, enter values in the available fields.
    Scheduler
    Select one of the following options:
    • Take action only on initial trigger: Select this option if you want to run the query after switching from the state of not meeting the condition to meeting the condition. By default, this option is selected. For example, suppose you have created an action to run a query when the temperature recorded by a device exceeds 40 degrees Celsius. Suppose the temperature recorded by the device is as follows: 35, 38, 41, 45, 39, 42. In this scenario, the query is run when the temperature is 41 and 42.
    • Take action on every trigger: Select this option if you want to run the query every time the event is triggered. For example, suppose you have created an action to run a query when the temperature recorded by a device exceeds 40 degrees Celsius. Suppose the temperature recorded by the device is as follows: 35, 38, 41, 45, 39, 42. In this scenario, the query is run when the temperature is 41, 45, and 42.
  4. Select Save or Save and Exit.
    The event template is created.

Results

When the event is triggered, the query that you have specified is run.