How to set ALL Values as a filter for a given column using Web Player JavaScript API.

How to set ALL Values as a filter for a given column using Web Player JavaScript API.

book

Article ID: KB0082636

calendar_today

Updated On:

Products Versions
Spotfire Developer All Versions

Description

Sample implementation on how to set the "All Values" filter from Web Player JavaScript API

Issue/Introduction

How to set ALL Values as a filter for a given column using Web Player JavaScript API

Resolution

Implement the "filteringOperation.ADD_ALL" enumeration which does not require setting the values property in FilterSettings .

From the documentation:

ADD_ALL    >> Adds all values to the filterColumn. The values property in FilterSettings must not be set.
https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/T_spotfire_webPlayer_filteringOperation.htm

Below is a sample code snippet:
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);

                }

Additional Information

https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/M_spotfire_webPlayer_Filtering_setFilters.htm
https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/T_spotfire_webPlayer_filteringOperation.htm