Suppose You have two filtering schemas FS1 and FS2 and you added a filter from FS1 to the text area and selected a particular value. The following example is an IronPython script which can set same values to filter schema FS2.
Introduction
Suppose You have two filtering schemas FS1 and FS2 and you added a filter from FS1 to the text area and selected a particular value. The following example is an IronPython script which can set same values to filter schema FS2.
Example
Before creating this script you should create an R data function for store selected value from the text area to a document property and assign a script.
R Data Function
Input Parameter
Output Parameter
from Spotfire.Dxp.Application.Filters import * from Spotfire.Dxp.Application.Visuals import VisualContent from System import Guid SelectedList=[] #Array declare flag =0 if Document.Properties["Shipmode"]!=None: #If no Item selected we dont neeed to update the list SelectedList =Document.Properties["Shipmode"].split(',') flag=1 print (SelectedList) encodedSettings='' print (SelectedList) for item in SelectedList: # Remove the extra space(Document property contains an extra space #when we select multiple values) encodedSettings= encodedSettings+item.strip()+"," print (encodedSettings) encodedSettings= encodedSettings[:-1] mylist=[] mylist=encodedSettings.split(',') print (mylist) #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 == "FS2": #Second filter schema filterPanel.FilteringSchemeReference = fs #Let's find "Col_LBFilter" filter and read the selected Values #This example uses a listbox filter, you may use any. filterPanel.InteractiveSearchPattern = "Ship Mode" # Give the column name for filter in filterPanel.FiltersMatchingSearchPattern: if filter.FilterReference.Name == "Ship Mode": #check the given column is exist in filterpanel lbFilter = filter.FilterReference.As[ListBoxFilter]() print (lbFilter.SelectedValues) lbFilter.Reset() #Reset filter lbFilter.IncludeAllValues = False print (mylist) if SelectedList!=None and flag==1: #If no Item selected we dont neeed to update the filter #print "sanandh" #print flag lbFilter.SetSelection(mylist)
Recommended Comments
There are no comments to display.