2 Replies Latest reply on Sep 26, 2017 2:56 PM by Steven Myers

    Two Dashboards to load alternatively on button click




      I want to use the Tableau Javascript API to create a page where I want to have two buttons that gives the user to select one and load the respective dashboard.


      I have a filter across both the dashboards that filters the views. When I load Dashboard 1 using button 1, then filter the views, Later when I click on button to load the dashboard 2 then I want the Dashboard 2 to load along with the filters applied for Dashboard 1.


      Can you please advise on how I can achieve this.


      Thank you!

        • 1. Re: Two Dashboards to load alternatively on button click

          Hello Nataraj,


          I believe the values could be passed from one to the other, though I am not 100% sure. My thought would be to pass the value from Filter 1 (button 1) to dashboard 1 & 2 and the same time. Then apply an additional filter to dashboard 2 with the secondary button.


          The precise calls needed I am a little uncertain.


          But I believe a use of calls, like from this example snippet, would be the correct ones to leverage:


          // Multiple Values - adding and removing .then(function () {

          return worksheet.applyFilterAsync("Product", ["Lemon", "Mint"],

          tableau.FilterUpdateType.ADD); }) .then(function ()

          { return worksheet.applyFilterAsync("Product", ["Caffe Latte", "Green Tea"],






          Additional information and reference for the above calls found here: Tableau JavaScript API Concepts--Filtering




          • 2. Re: Two Dashboards to load alternatively on button click
            Steven Myers

            I would use getFiltersAsync() and iterate through the collection from dashboard 1, stepping through getFieldName(), getFilterType() and getAppliedValues() to load an array that you could then use to applyFilterAsync() on dashboard 2. Note the warning in the API documentation regarding the 200 value limit for getAppliedValues(). There is no getting around that item presently so if your dashboard 1 has any filtered field which can employ more than 200 values, you may be stuck.