Testing a report from first principles

You can check if a report is correct without having to compare it with a reference version. The example below illustrates how it can be done:

Let’s consider the following data set:

We want to test that at least one project has less than 30 employees.

First, we filter the data to select projects with less than 30 employees using the ‘Filter Cell on Row Value’ operation.

Next, we add a ‘Try’ operation which can be found under ‘Control Flow’.

Then we check that the filter returned at least 1 entry using an ‘Assert True’ operation:

More logic can be put here, for example we can calculate the total cost of these projects using a ‘Get Summary Statistics’ operation from the ‘Data Aggregation’ section, and insert a ‘Write to Console’ directly underneath (found in ‘Data Input/Output’ section):

Finally we must introduce the second operation which we want to execute should the above operation fail (no projects with less than 30 employees).

We add a ‘Do If Try Fails’ found under ‘Control Flow’ and add a ‘Write to Console’ with a message:

When we run this task, in the console we will get either the total cost of projects with less than 30 employees, or the message saying there are no projects with less than 30 employees.