Query Rows

Pulling rows from a table

The query rows action allows you to pull data from a table, with several filtering and sorting options available.

Query rows action

Query rows action


Table

The first dropdown requires that you select a table.

If you forget to choose a table, the error output of the automation will inform you.

Make sure to select a table for your Query Rows action!

Make sure to select a table for your Query Rows action!

With a table selected, you can select an optional Sort Column and Sort Order. If these fields are left blank, then the rows will be returned in no particular order.

You can also choose to add an optional Limit to the number of rows returned, otherwise the default maximum limit will be used.

Internal DBSQL DB
Maximum of 1000 rows returnedMaximum of 5000 rows returned

Filtering

You may provide filters when querying table rows by clicking the Define filters button. Filters can be against static values, or against Bindings.

Filtering rows

Filtering rows (static value and binding examples)

The final setting is labelled When filter empty. This determines what data is returned if a Binding value is used in a filter, but is empty.

For example, in the screenshot above we filter on the {{ trigger.fields.Name }} binding. If that binding was empty, then you have the choice of returning:

  • All table rows
  • No table rows

🚧

Update/Delete rows

If you are looping over the output of a Query Rows action to perform updates or deletes in the next step, it is important that you consider what happens if your binding is blank.


Using the query rows output

You can access the output of a Query Rows action through the Binding: {{ steps.X.rows }}, where 'X' is the step number of your action.

For example you would use {{ steps.1.rows }} for the following action:

Step 1: Query Rows

Step 1: Query Rows

This binding is particularly useful in automation Looping, where you want to perform an action for each row retrieved.