Přejdi na obsah Přejdi na navigaci

HomepageBlog2 ways how to create Drop down filters in TIBCO Spotfire®

2 ways how to create Drop down filters in TIBCO Spotfire®

If you are developing some Spotfire dashboard, sooner or later you come to the realization that filters in the filtering panel are simply not enough. There are many cases where you want to put one or two filters directly in the dashboard itself and you can add them quite easily. Just create a new text area and insert any filter that you need. However, the classic drop-down filter is not an option. Yes, it is not, but you can create it in another way. You have at least two ways how to do that! You can either add a drop-down filter, which is not a filter, but still can limit data in any visualization that you want or you can create a script that would control the corresponding filter in the filtering panel. The first option is super easy, but it has some disadvantages. I will talk about them later in this post. The second approach lies in the creation of a drop-down menu, which would adjust the actual filter in the filtering scheme through the IronPython script. It is a little bit more complicated, but in the end, it can result in less work and less confusion at end-users than the first option. In my opinion, knowledge of both options gives you the chance to select the best one for your specific use case. I would like to describe the solution without the IronPython script in this article. If you are interested in the second option, read this article.

I also created a video about this topic. If you prefer video to the blog post, feel free to watch it on our new Spotfire Youtube channel. Ok, that was a long beginning, let’s start with the fun part finally.

I will demonstrate how to create the drop-down on the example of typical sales data and an easy bar chart which I would like to filter based on my year column. The column consists of years when each order happened.

property control

As I mentioned, you need a text area and you have to add new property control. The control type is a drop-down list.

drop-down list

Then create new document property. Data type depends on your case. I was creating a drop-down list that would filter orders to one specific year. Because of this, I selected integer as a data type. If you have a similar case as I had, then you should set property value through unique values in a column. This option is much better than fixed values. If you selected the fixed values option, you would have to add every new unique value manually and we definitely do not want to do that. My option will add each new year in my dataset to my drop-down list automatically.

Ok, now the value, which is selected in the drop-down list, is saved to your document property. With this knowledge, we can continue to the next step.

dataset in drop-down list

The next step is the adjustment of all visualizations that should be affected by the drop-down list. Go to the properties of each chart, select a tab called Data and edit expression which is limiting a chart.

The adjustment of all visualizations

The resulting expression must be Boolean. You have to tell Spotfire that you want to limit the data for this chart according to your drop-down ”filter”. Simply write [NameOfYourColumn]=DocumentProperty(‘NameOfYourDocProperty’).


Now, you are all set! You have your own drop-down filter without any coding. However, keep in mind that you have to adjust the limiting expression of each chart that you want to be filtered by your drop-down list. You can add one more nice thing, though. You can control with your drop-down also visualization title.

drop-down visualization title

How? Go to visualization properties and select the General tab. Click on the edit button next to the title field.

Visualization title

Select your document property and insert it into the title expression. And that’s everything. Now, your selection in the drop-down filter will be shown in the visualization title.

Final thoughts

Be aware that this is actually not a filter. My corresponding filter in the filtering panel is not touched at all.

Final thoughts

It can be a little bit confusing for some users when they see that one filter in the filtering panel is telling that there is no filtering done and the second “filter” in the text area is telling that you have already used a filter. If you want to avoid this, then you have to play with IronPython a little bit. I recommend checking my blog post about this topic.


Author: Filip Prochazka

Spotfire Version: 10.10

Created: 3/12/2021

Zpět na výpis rubriky