Running a query

Overview

The [highlight txt=’run query’] instruction allows a user to run a query on a Access database Table. The instruction can be configured to check whether the number of rows it modifies satisfies a particular condition.

[message type=”warning”]For the purposes of this article we are going to use a simple and fictitious Access database. You will want to replace this file with one of your own.[/message]

Before we get started

Please further create a ‘Manipulate a file’ or ‘Multiple file manipulations’ action step so that you can add and use instructions.

The Access database Table contains the following data:

Steps

1. Create a ‘Run query’ instruction.

2. Open the Expert SQL Editor by clicking the ‘View/Edit SQL’ hyperlink.

3. In the Expert SQL Editor, you can write the query you want to run, as well as specify the Table you want to run the query on. Here, we will write a query which clears all the data from the Table1. Type “DELETE FROM [Table1]” into the Editor.

4. Save the query.

5. Enable the ‘Check the numbers of rows modified to determine if this step was successful’ rule by ticking its box.

6. The first part of the ‘This step is successful if the number of modified rows’ condition is set to ‘Is exactly’ by default. Other options include ‘Is more than’ and ‘Is less than’.

7. Type “3” into the field for the second part of the ‘This step is successful if the number of modified rows’ condition. Alternatively, adjust the ticker next to this field to “3”.

8. Save and run the step.

9. If the step runs successfully, it means that exactly 3 rows were modified in the Table. As we saw earlier, there were only 3 rows in the Table. Therefore, a query which clears the Table must modify exactly 3 rows. After the step finishes running, open the Access database Table. You will see that the Table has no rows remaining:

Recent Posts

Leave a Comment