1 Reply Latest reply on Aug 29, 2016 4:49 PM by diego.medrano

    Errors filtering multiple fields at once with JS API.

    Robert Rouse

      I am trying to clear the filter on two fields at once and am getting the following error:

       

      viewmodel error.png

       

      Does anyone know what this error message means? Once I hit OK, the filter actually applies correctly to the viz.

       

      I'm using the clearFilter function from the API tutorials:

      function clearFilter(filterName) {
           sheet = viz.getWorkbook().getActiveSheet();
           if(sheet.getSheetType() === 'worksheet') {
                sheet.clearFilterAsync(filterName);
           } else {
                worksheetArray = sheet.getWorksheets();
                for(var i = 0; i < worksheetArray.length; i++) {
                worksheetArray[i].clearFilterAsync(filterName);
                }
           }
      }
      

       

       

      My code calls the clearFilter function for both fields this way:

       

      clearFilter('Agency');
      clearFilter('Bureau');
      setParameter('Division','Federal');
      

       

      Would it be necessary to chain these called with .then to avoid this error?