1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | from Spotfire.Dxp.Application.Visuals import VisualContent from System import Guid
page = Application.Document.ActivePageReference
#Get the filtering scheme used on this page filteringSchemeRef = page.FilterPanel.FilteringSchemeReference
#Get the name of the filtering scheme on the active page for filteringScheme in Document.FilteringSchemes: filteringSelection = filteringScheme.FilteringSelectionReference if filteringScheme == filteringSchemeRef: filteringSchemeName = filteringSelection.Name
content="<STRONG>Filtering Scheme:</STRONG> " + filteringSchemeName
filterPanel = page.FilterPanel filterPanel.InteractiveSearchPattern = "status:m"
for filters in filterPanel.FiltersMatchingSearchPattern: print filters.FilterReference.ToString()
for tableGroup in filterPanel.TableGroups : print tableGroup.ToString() tableGroup.Expanded=True for filterGroup in tableGroup.SubGroups : print filterGroup.ToString() print filterGroup.Expanded filterGroup.Visible=False if (filterGroup.Expanded == False): filterGroup.Expanded = True else: filterGroup.Expanded = False
for tableGroup in filterPanel.TableGroups: isMod=0 str="<p>" if filterPanel.TableGroups.Count > 1: str+="<b>"+tableGroup.FilterCollectionReference.DataTableReference.Name+":</b><br>" for fh in tableGroup.FilterHandles: if fh.FilterReference.Modified: isMod=-1 str+=fh.FilterReference.ToString() str+="<br>" for subGroup in tableGroup.SubGroups: for fh in subGroup.FilterHandles: if fh.FilterReference.Modified: isMod=-1 str+=fh.FilterReference.ToString() str+="<br>" str+="</p>" if isMod==-1: content+=str
ta=vTextArea.As[VisualContent]() if(ta.HtmlContent is None): ta.HtmlContent = " "
if (ta.HtmlContent.find("<SPAN id=fs>")==-1): ta.HtmlContent=="<SPAN id=fs>"+ta.HtmlContent final=ta.HtmlContent.split("<SPAN id=fs>")[0]+"<SPAN id=fs>"+content+"</SPAN>" ta.HtmlContent=final
#Reset filter panel search and navigate to the Filter Settings Page filterPanel.InteractiveSearchPattern = ""
|
Input:vTextArea (Text Area): The text area that will be modified to show the current filter settings.
This script will list the modified filters for the current page, and how they have been modified. The output will be generated in HTML format and inserted into the specified text area. Here is a sample of the output:
Here is a similar variation that also is compatible with in-database connections:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | from Spotfire.Dxp.Application.Visuals import VisualContent from System import Guid
page = Application.Document.ActivePageReference
#Get the filtering scheme used on this page filteringSchemeRef = page.FilterPanel.FilteringSchemeReference
filterPanel = page.FilterPanel
#Now set the filtering scheme to that of the originating page filterPanel.FilteringSchemeReference = filteringSchemeRef
for filteringScheme in Document.FilteringSchemes: filteringSelection = filteringScheme.FilteringSelectionReference if filteringScheme == filteringSchemeRef: filteringSchemeName = filteringSelection.Name
content="<STRONG>Filtering Scheme:</STRONG> " + filteringSchemeName + "<BR><BR>"
filterPanel.InteractiveSearchPattern = "status:m" for filters in filterPanel.FiltersMatchingSearchPattern: content += filters.FilterReference.ToString() + "<BR>"
ta=vTextArea.As[VisualContent]() if(ta.HtmlContent is None): ta.HtmlContent = " "
if (ta.HtmlContent.find("<SPAN id=fs>")==-1): ta.HtmlContent=="<SPAN id=fs>"+ta.HtmlContent final=ta.HtmlContent.split("<SPAN id=fs>")[0]+"<SPAN id=fs>"+content+"</SPAN>" ta.HtmlContent=final
filterPanel.InteractiveSearchPattern = ""
|