DropDown menu to control a column in the filter panel and a Reset button that clears all the filters

Hello All,

I have 2 requirements:

  1. The dropdown menu needs to filter a column in the filter panel. For example, the dropdown menu contain [Years] and when you select a year from the dropdown, it also filters the [Years] column in the filter panel based on your dropdown selection.
  2. A Reset button that unmarks and clears all filters. The issue im running into here is that when i hit the reset button, it unmarks and clears all the filters, but the dropdown selection still shows a single year which is misleading because the data is no longer displaying values for only that year. Either the reset button needs to unmark and clear all the filters except for the year that is displayed in the dropdown OR the reset button unmarks and clears filters for everything AND also displays and "All" value in the dropdown menu so that the user knows that "All" data is being displayed.

Please tell me how I can accomplish this! My main goal is to be able to filter the filter panel by selecting a value from a dropdown menu AND be able to reset and unmark all data with a button.....and somehow the dropdown menu needs to reflect "All" values. Please let me know if i need to elaborate more.

Below is the python script that I used. I've also added a sample .dxp file of what I have thus far.

Thanks in advance for your help!

SCRIPT:

# import the ListBoxFilter class
from Spotfire.Dxp.Application.Filters import ListBoxFilter

# locate the data table and grab the filter collection
dt = Document.Data.Tables["YearTable"]
filters = Document.FilteringSchemes.DefaultFilteringSchemeReference[dt]

# repeat the below lines for any other filters you would like to change

# choose the filter we are interested in
f = filters["Year"].As[ListBoxFilter]()

# unset "IncludeAllValues" or nothing we change will matter
f.IncludeAllValues = False
# set the value we are interested in
f.SetSelection(YearParam)

SCRIPT PARAMETER:

  • Name is YearParam
  • Type is Integer
  • Debug Value is my dropdown menu property control

 

Attachments

AttachmentSize
Binary Data filtertest.dxp215.87 KB

(2) Answers

Login