如何根据从下拉属性控件中选择的值更改多个默认过滤器?
如何实现此功能?
感谢任何帮助。
答案 0 :(得分:1)
你的问题没有太多细节,所以我在这里做了很多假设,最重要的是你正在处理ListBox过滤器;此代码不适用于其他过滤器类型。这是我正在使用的数据集:
NAME DEPARTMENT alice marketing bob sales charley sales dave engineering
Department
的新文档属性,它将是字符串并包含默认值sales
Department
列ChangeFilter
。 添加... 脚本参数 department_name
,将其设置为字符串,然后选择属性:,最后点击选择属性... 将其设置为我们的department
文档属性 # 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)