The filter tool allows you to query your data by using one or more expressions or conditions in your columns. The data set is then split into two, true and false. True is where the data meets the criteria you've set and false is where it doesn't. This tool is useful if you need to return only a specific set of records for your data. For example, if you have a list of employee information, but you only want to look up employees whose favorite coffee is along black, well, that's what I've illustrated in the slide here. Again, our first picture has our employee HR data set.
The second picture is where I've included the filter tool and put a criteria of favorite coffee equals one black. There are two browse tools here, one connected to a tee output for true and one connected to an F output for false. When I run the workflow, I get an output of five employees Have a favorite coffee of long black. Let's start a new workflow by importing spreadsheet 2.5 or go to the Insert tab, dragging our input data tool and connect to the 2.5 filter worksheet. We have our example HR file again with 30 employees in it. And let's just note the number of black coffees in there, we've got 12345 so let's go to the preparation tab and drag in our filter tool.
And in the configuration menu on the left, we have two main options a basic filter or a custom filter. Basic is what most people will select if they have one condition. In our case, we want to select how favorite coffee where a equals a long black The middle boxes are operator and the right box is the value we want to filter by. You will notice under custom filter, our tricks has populated the values and syntax based on our basic filter. Values wrapped around the square brackets are our variables. And the double quotes is the value that we're filtering by.
Let's add a browse tool to the true and false outputs of the filter tool. We can do this with our keyboard shortcut of Ctrl Shift B. And we'll run our workflow. Our data set has been filtered by one condition where an employee's favorite coffee as long black, as seen in the slide previously and manually counting just then. Let's now try a custom filter which is used for more complex expressions. Mainly if you have two or more conditions We'll click on filter, and we have the choice of typing directly into the expression editor or using these buttons here on the side.
The effects shows the list of functions available, and x shows the variables in our data set. Let's practice writing a custom filter. So we'll delete what's already in here. We'll start by clicking variables and adding favorite coffee. Let's put in equals and in double quotes type in long black with a space will then add another filter within our five employees and select where age is less than 30. So we'll type in and and in square brackets, type in age and use the less than or operator in typing 3030 doesn't need double quotes because it's a number not string.
Let's press the run workflow button or Ctrl R. And we can see our data set has been filtered by to conditions where an employee's favorite coffee is along black and their age is less than 30.