Jump to content
  • How to set filters Using the Spotfire® JavaScript API


    Below is a sample implementation example of how to set the filters from Web Player JavaScript API.

    Introduction

    Below is a sample implementation example of how to set the filters from Web Player JavaScript API.

    Code Sample

    // Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    //1. Setting of "(All) x values" as a filter for a give column.
    function SetAllValuesFilters() {
                        
                        var filterColumns = new Array();
                        filterColumns[0] = {
    
                            filteringSchemeName: "Filtering scheme",
    
                            dataTableName: "World Bank Data",
    
                            dataColumnName: "Country Code",                        
    
                            filterSettings: {
    
                                includeEmpty: true                            
                            }
                        }                    
                         
                            _analysisDocument.filtering.setFilters(filterColumns, spotfire.webPlayer.filteringOperation.ADD_ALL);
    
                    }
    
    // 2. Set filter to a particular value(s) for given columns
    function SetFilterValues() {
    
                        var filterColumns = new Array();
                        filterColumns[0] = {
    
                            filteringSchemeName: "Filtering scheme",
    
                            dataTableName: "Data Table",
    
                            dataColumnName: "Sales",
    
                            filterSettings: {
    
                                includeEmpty: true,
    
                                values: [20000]
                            }
                        }
    
                        filterColumns[1] = {
    
                            filteringSchemeName: "Filtering scheme",
    
                            dataTableName: "Data Table",
    
                            dataColumnName: "Group",
    
                            filterSettings: {
    
                                includeEmpty: true,
    
                                values: ["GroupB"]
                            }
                        }
                            _analysisDocument.filtering.setFilters(filterColumns, spotfire.webPlayer.filteringOperation.REPLACE);
                    }
     

     

    References

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in Spotfire® Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...