1 Reply Latest reply on Apr 3, 2019 11:32 PM by patrick.byrne.0

    getAppliedValues() on a hierarchical filter class

    Ryan Anderson

      Some background:

       

      I am trying to develop with Tableau against an Analysis Services datasource (This type of datasource often requires special 'hierarchical' calls for Tableau, for example see API reference for applyHierarchicalFilterAsync versus applyFilterAsync).  If I continue with Tableau, my front end application will be the window into hundreds of visualizations which use hundreds of different dimensions (some dimensions containing thousands of dimension members) and also hundreds of different measures.  The best way I have found to filter visualizations with this quantity of dimensions is through select-able lists that when a dimension is chosen, displays a tree view which I have successfully got filtering Tableau visualizations at this time.  As you can imagine, hundreds of dimensions across many visualizations is very hard to track which dimensions are currently being filtered when this tree view appears (which must be done), I was hoping that I could solve this problem by returning the appliedFilterValues but I cannot get it to work against the hierarchical datasource and I haven't been able to find any examples of people making it work. 


      Has anyone been able to get this to work against cubes and could you please post a code example?


      Here is the current code that I am working with. 

       

       

       

                      function getFiltersAsync() {
                          // Get first worksheet in book
                          var worksheet;

       

                          var onSuccess = function (filters) {
                              console.log("This worksheet has " + filters.length + " filter(s) associated with it.");
                              console.log('The first filter name is ' + filters[0].getFieldName());
                              console.log(filters[0].getAppliedValues()[0].value);
                              console.log('end');
                          };

       

                          var onError = function (err) {
                              alert("Whoops");
                          };

       

                          viz.getWorkbook().activateSheetAsync("for_date_filter").then(function (sheet) {
                              worksheet = sheet;
                              worksheet.getFiltersAsync().then(onSuccess, onError);
                          });
                      }

       

       

      The console reads:

       

      The worksheet has 1 filter associated with it.

      The filter name is Date

       

      *and then it breaks*

       

      Again, any help is very appreciated. 

       

      Ryan