3 Replies Latest reply on Mar 19, 2020 2:19 PM by Michael Gillespie

    Retrieving the selected values in a filter

    Angel Macias

      Hi all,


      I have been trying to find a way to retrieve the selections of a filter when it is changed. For example, if there is a filter with the following values: "ALL", "Blue", "Orange", "Green", with the bold values being the ones selected, what method would I use to retrieve those?


      Below is a code snippet at my attempt at this.


      I am using Tableau 2019.2 as well a Tableau Extensions JS library.


      worksheet.addEventListener(tableau.TableauEventType.FilterChanged, onFilterChange);
      // ... misc code here
      function onFilterChange(filterChangeEvent) {
          filterChangeEvent.getFilterAsync().then(function (filter) {
              filter.getFieldAsync().then(function (field) {
                  let dataSource = field.dataSource;
                  let dataSourceName = dataSource.name;
                  let dataSourceFields = dataSource.field;
                  let postData = [];  //Array that will be sent to server
                  //do stuff here            


      I have been using this documentation for reference: Filter | Dashboard Extensions


      Thanks for your time,