Reputation: 51
how can I change multiple default filters based on the value chosen from a dropdown property control?
How do I achieve this functionality?
Any help is appreciated.
Upvotes: 1
Views: 2658
Reputation: 3974
there's not a lot of detail in your question, so I'm making a lot of assumptions here, most importantly that you are dealing with ListBox filters; this code will not work with other filter types. this is the dataset I'm using:
NAME DEPARTMENT alice marketing bob sales charley sales dave engineering
Department
, which will be a String and contains the default value sales
Department
columnChangeFilter
. Add... a Script parameterdepartment_name
, set it to String, then select Property:, and finally click Select Property... to set it to our department
Document Property# import the ListBoxFilter class from Spotfire.Dxp.Application.Filters import ListBoxFilter # locate the data table and grab the filter collection dt = Document.Data.Tables["Data Table"] 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["department"].As[ListBoxFilter]() # unset "IncludeAllValues" or nothing we change will matter f.IncludeAllValues = False # set the value we are interested in f.SetSelection(department_name)
Upvotes: 1