Jump to content
  • How to reset the filters of an active data table in Spotfire® using IronPython Scripting


    This article provides a guide on resetting all filters within an active data table using IronPython

    Introduction

    This article describes how you can reset all the filters of an active data table. If there is only one data table in an analysis file, then by default it will be the active data table every time. If there are multiple data tables, then to make any data table active (if it is inactive) we need to click in any one of the visualizations made from that data table.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc.
    # Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application import Filters as filters 
    from Spotfire.Dxp.Application.Filters import TableGroupCollection  as TableGroups 
    
    
    myPanel = Document.ActivePageReference.FilterPanel
    
    for group in myPanel.TableGroups:
        # to get the required table group from the filter panel
        if group.Name == Document.ActiveDataTableReference.Name: 
           for col in Document.ActiveDataTableReference.Columns:
               # reset each and every column of an 
               # active data table
               myFilter= group.GetFilter(col.Name)
               myFilter.FilterReference.Reset()
    
           break
           # breaking the outer for loop once the desired
           # table group is found..
     

    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...