Jump to content
We've recently updated our Privacy Statement, available here. ×
  • How to Remove Unreferenced Filtering Schemes in an Analysis in Spotfire® Using IronPython Scripting


    This article shows how to Remove Unreferenced Filtering Schemes in an Analysis in Spotfire® Using IronPython

    Introduction

    Below is a sample script to remove any Filtering Schemes available in the analysis which are not referenced by any visualizations.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    from System.Collections.Generic import List
    listofFilteringSchemes=set()
    
    for page in Document.Pages:
    	for vis in page.Visuals:
    		if str(vis.TypeId) != "TypeIdentifier:Spotfire.HtmlTextArea":
    			visData= vis.As[VisualContent]().Data
    			if visData.UseActiveFiltering:
    				fs=page.ActiveFilteringSelectionReference.Name
    				listofFilteringSchemes.add(fs)
    			if visData.Filterings.Count!=0:
    				for i in visData.Filterings:
    					listofFilteringSchemes.add(i.Name)
    
    for i in Document.FilteringSchemes:
    	name=i.FilteringSelectionReference.Name
    	if name not in listofFilteringSchemes:
    		Document.Data.Filterings.Remove(i.FilteringSelectionReference )
     

    References

     

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in Spotfire Examples:  https://community.spotfire.com/s/article/IronPython-Scripting-in-Spotfire

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...