3 Replies Latest reply on Dec 17, 2014 11:58 AM by Curtis Dieu

    clearFilterAsync not clearing Filters

    Sabrina Jordan

      I'm using applyFilterAsync and successfully applying a filter; however, clearFilterAsync when applied to the same filterName does not clear the filter. 

       

      function showOnly(filterName, values) {

          sheet = viz.getWorkbook().getActiveSheet();

          if (sheet.getSheetType() === 'worksheet') {

              sheet.applyFilterAsync(filterName, values, tableauSoftware.FilterUpdateType.REPLACE);

          }

          else {

              worksheetArray = sheet.getWorksheets();

              for (var i = 0; i < worksheetArray.length; i++) {

                  worksheetArray[i].applyFilterAsync(filterName, values, tableauSoftware.FilterUpdateType.REPLACE);

              }

          }

      }

       

       

      function clearFilter() {

          sheet = viz.getWorkbook().getActiveSheet();

          if (sheet.getSheetType() == 'worksheet') {

              sheet.clearFilterAsync('ApplicationName');

          }

          else {

              worksheetArray = sheet.getWorksheets();

              for (var i = 0; i < worksheetArray.length; i++) {

                  sheet.clearFilterAsync('ApplicationName');

              }

          }

      }