Chcete být Data-driven?

Tak buďte Data-informed & Data-inspired

qlik sense

How to set a specific filter in TIBCO Spotfire® using IronPython script

Iron Python script for filtering in TIBCO Spotfire by using a property control makes your dashboard more interactive and intuitive.

In my previous article, I showed how to create a drop-down filter without any coding. The principle lies in the addition of a condition to limiting the expression of each chart that should be filtered. The drop-down list is connected to document property and the same document property is then used in the condition(s). Change in drop-down list is reflected in an adjustment of document property, which adjusts limitation of data in each chart where we changed the data limiting expression. As you probably feel from my description, this approach has several disadvantages. All of them can be overcome with a different approach. As the title of the article indicates, the different solution is the usage of the IronPython script which would control the actual filter in the filtering panel. Ok, so what is the goal for today? The goal is to create a drop-down list that will behave as a filter. In fact, it will be document property connected to the IronPython script which will control the filter, but for the end-user, it will behave exactly like a typical Spotfire filter.

If you prefer video to the blog post, then visit our new Spotfire Youtube channel because I created also a video for this particular topic. I described my steps a little bit more in the video, therefore I recommend watching a video if you are a total beginner. I will use the same sales data and the same simple bar chart as in my previous article. I have a column that consists of information about when each order happened. My goal is to create a drop-down filter that would be based on this column. You need to create a text area and add drop-down list property control.

Create new document property and assign it an appropriate data type. If you do not know which one, check the data type of the column that you want to use for filtering in the column properties section. In my case, it is an integer. Set property value through unique values in the column and select column, whose values should be used as options for filtering.

Then click on the script button and select “execute the script selected below“ and click on New.

Execute the script selected below


Assign script some name and add following script:

from Spotfire.Dxp.Application.Filters import CheckBoxFilter

#refer to filter as checkbox


#print myYearFilter

for value in myYearFilter.Values:




You need to change the name of the document property and the name of the column. It is also needed to add script parameter for a data table.

Select a data table that contains the column which will be used for filtering.

Confirm everything and check that your filter works!

Author: Filip Prochazka

Spotfire Version: 10.10
Created: 3/12/2021

Mohlo by vás zajímat

V roce 2021 jsme vydali řadu článků, ve kterých jsme se snažili podělit o naše znalosti a zkušenosti ze světa Business Intelligence. A protože jsme si s nimi dali dost práce, neradi bychom, aby zapadly.

3 min
Číst další

Chcete nás kontaktovat?

Drop files here or
Max. file size: 2 MB.