Set Range Filter using IronPython

Hello,

This looks like other questions which have been posted but I can't seem to adapt those solutions to my simple requirement. 

I just need a Range Filter to be set to a range of week numbers ('Wk' column) upon execution. This is a visible filter which users can then use to select a longer range of weeks if required (so 'limit data' will not work). I have a number of Filtering Schemes.

I'm trying to use the code below, adapted from elsewhere on this site, but I am getting the error: AttributeError: 'RangeFilter' object has no attribute 'SetRange'

What is a 'NoneType object'?

The best solution will identify the 'max' week and set the filter accordingly to that value, but as you can see I am doing that element manually here, setting both the min and max to integer value of 15.

Here's the code:

from Spotfire.Dxp.Application.Filters import *

from Spotfire.Dxp.Application.Visuals import VisualContent
from System import Guid

#Get the active page and filterPanel
page = Application.Document.ActivePageReference
filterPanel = page.FilterPanel

#Get reference for FilteringScheme used for your filter
for fs in Document.FilteringSchemes:
    if fs.FilteringSelectionReference.Name == "HierWithBranches": 
        filterPanel.FilteringSchemeReference = fs

filterPanel.InteractiveSearchPattern = "Wk"
for filter in filterPanel.FiltersMatchingSearchPattern:
    if filter.FilterReference.Name == "Wk":
        lbFilter = filter.FilterReference.As[RangeFilter]()
    minmax = 15
    lbFilter.SetRange(minmax,minmax)

 

(4) Answers

Login