6. Alternative Filters

 
Subtitles Enabled

Sign up for a free trial to access more free content.

Free trial

Overview

In this fifth and final lesson designed to introduce you to Analytical Apps, you will learn how to introduce detours into your workflow so that your app can offer alternative options to the user.

Lesson Notes

Detour tool

  • The Detour tool splits the workflow into separate branches based on a factor, generally an interface tool
  • Detour tools are often paired with Detour End tools, which combine the previously split workflow branches.

Numeric Up Down tool

  • The Numeric Up Down tool allows users to specify a specific value in the underlying workflow tool
  • In the configuration window, we can specify minimum values, maximum values, increments, and the default value

Radio button

  • Radio buttons allow users to choose one item from a list of options
  • Radios are very useful in app interfaces, and can be paired with Detour tools

Transcript

- [Instructor] Over the last few lessons, we've looked at ways to introduce optionality into the workflow using interface tools. So far, we've given the user the option to specify a date range and filter the list of products. In this lesson, we're going to finish off our app by adding another filter. Our new filter will allow users to generate a sales report based on percentage of sales during the specified period. Let's take a step back for a moment and think logically about what we're trying to achieve. Our goal is to create an app that generates reports for different time periods and can be filtered by either product name or percentage of total sales during the period.

However, the user cannot do both. It's an either/or situation.

If we look at the completed app, we can see that we specify the date range, and then select which filter option we'd like to apply in the report.

In order to modify the workflow to meet our requirements, we'll need to take three key steps.

First, we'll create a workflow detour for our new filter using the detour tool.

Next, we'll configure the interface of our app to correctly display the filter options.

Finally, we'll group the filters on the interface in order to ensure that only one filter can be selected at a time.

In order to create a workflow detour, we'll make use of the detour tool found on the Developer tab of the Tools palette.

Before we can add the tool, we'll need to change our current workflow. As you can see, the current workflow flows from the select tool to the product filter and then directly to the output tools.

To make room for a detour, we'll need to delete the connection between the select tool and the filter tool as well as the connection between the true node of the filter tool and the basic table tool. We'll now move the product filter tool together with the associated list box and action tool down on the canvas.

This will become the right branch of our detour.

We'll then bring a new filter tool onto the canvas above these icons.

We'll now navigate to the Developer tab and connect a detour tool to the select tool.

The right node will go to the product filter tool while the left node will go to the new filter tool.

In the configuration window, we'll set the detour tool to detour to the right.

We'll then label this new filter tool as % Sales Filter to keep things clear.

We can now complete the circuit by bringing a detour end tool onto the canvas and connecting the output to the basic table.

We'll then connect the true node of the new filter to the left input and the true node of the product filter to the right input.

We'll now navigate to the new filter tool and use the basic filter options to specify a percentage of total sales greater than or equal to 0.01.

This will allow us to create a percentage of total sales toggle in our app.

Now that our detour is complete, we can move onto the next step and configure the interface tools for our new filter. As we saw previously, the interface tab contains the number of tools that add optionality to our app fields such as checkbox, date picker, dropdown and list box.

As we're filtering by percentage of sales, an appropriate interface tool to use might be the numeric up/down tool. We'll bring this tool onto the canvas and connect it to the sales filter tool.

In the configuration window, we'll enter % of Total Sales greater than or equal to in the text to be displayed box.

We'll also set the default value at one, and the number of decimal places at four.

We'll go back to the action tool, expand simple, and operands and select operand value 0.01.

We'll now head over to the Interface Designer and see that the new toggle has been added to our app.

However, since the user can only use one of these filters, we need to create this option in the app. A good way to do this is to create a choice of two radio buttons.

We'll go back to our workflow, bring our radio button tool onto the canvas, and connect it to the first detour tool.

In the configuration window for the action tool, we'll ensure that the selected action is update the detour direction from a question.

As you can see in the text below, this means that the detour will go to the right if the radio button is selected, and to the left if it's not.

However, we'll add two radio buttons here so the second button will override the first. This means that the first button will actually go to the left and not the right.

Given this information, we'll go to the configuration settings for the radio button, specify to display the text Filter by % of Sales and check the collapsing the group when deselected box.

We'll bring a second radio button tool onto the canvas again connecting it to the detour tool.

The action tool settings are the same as before.

We'll navigate to the radio tool, set the text as filter by product and again choose to collapse the group when deselected. Now that we've configured our interface tools, we'll make them behave as expected within our app.

The final step involves grouping the filters in the interface layout.

This is important because the filters must be either/or options in order for the app to work correctly. It cannot be possible to select both at the same time.

We'll now head back to the Interface Designer to correctly group the filters.

We'll place the % of Sales filter within the % of Sales radio button group and the choose products filter within the filter by product group.

Finally, we'll create a new group called refine results, and place both filters in that group.

We'll go to the Properties tab and see that there's an option to specify how we want the app to conclude.

We'll specify that on success, we wish the app to run our render tool.

We'll now click on the magic wand icon and see that the user is presented with a start date and end date.

The configuration defaults the filtering by percentage of sales, however, if we instead choose to filter by product, we can see the sales threshold minimizes and we instead a list of products.

We've successfully created an app that generates sales reports for different periods filtering by either product or percentage of sales.

To recap, we achieved this in three key steps.

First, we created a workflow detour for our new filter using the detour tool.

Next, we configured the interface tools of our app with appropriate filter inputs that collapse under radio buttons.

Finally, we grouped the filters in the Interface Designer in order to ensure that only one filter could be selected at a time.

Over the past five lessons, we've seen just how interface tools can be used to create apps that makes our workflows more dynamic.

In our next lesson, we'll move on to another Alteryx device, the macro.