Jump to content

Is it possible to move a filter to the top of the filter panel using IronPython, similar to what happens with the 'Move First' button in the Organize Filters dialog box?


Kevin Brogle

Recommended Posts

I cannot find a straight function to re-order the filters for a data table.

This script might do the job, although I am not sure it is the simplest way:

from Spotfire.Dxp.Application.Filters import *from Spotfire.Dxp.Application import PanelTypeIdentifiers my_table=Document.Data.Tables['my data table']column_name='my column name' #Locate the filter panel for the active pagefor panel in Document.ActivePageReference.Panels: if panel.TypeId == PanelTypeIdentifiers.FilterPanel: my_filter_panel = panel #Locale table group for my data tablefor group in my_filter_panel.TableGroups: if group.Name == my_table.Name: my_group=group #Locate the filtering scheme for the panelmy_filtering_scheme=my_filter_panel.FilteringSchemeReference #Identify filter for column we want to move upmy_filter=my_filtering_scheme.Item[my_table].Item[my_table.Columns.Item[column_name]] #First remove all filtersmy_group.ClearFilters()all_filters = my_filtering_scheme.Item[my_table]#Then add my top filtermy_group.Add(my_filter)#Then add the rest of the filtersfor f in all_filters: if f.Name != my_filter.Name: my_group.Add(f)
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...