3 Replies Latest reply on Feb 27, 2015 6:24 AM by james.n

    Set a quick filter using Tableau API


      I have a dashboard containing several worksheets and quick filters.  I am new to Tableau and trying to learn more about controlling the visual using the JavaScript API.  One of my worksheets has a drop-down list of schools as a filter.  The code below filters the list to a single name. 


      It does not however, change the selection in the drop-down.  It reduces a longer list to the single name which includes the option "All".  My information will not show because the school hasn't actually been selected from the drop down.


      function setSample1HS() {


          .then(function (sheet) {

            dashboard = sheet;

            worksheet = dashboard.getWorksheets().get("Attendance");

            return worksheet.applyFilterAsync("School Name (Currently Attending)", "Sample1 HS", tableauSoftware.FilterUpdateType.REPLACE);


          .then(function (sheet) {

            alert("School filtered to Sample1 HS");


          .otherwise(function (err) {

            alert("The following error occurred:\n\n " + err);




      Question: How can I make the filter also pick the filtered selection?  (This is a quick filter, not a data selection.)

        • 1. Re: Set a quick filter using Tableau API

          Hey James,


          In asking a colleague they said:


          The request is being put in a return call. Try putting it in a function instead (as shown in section 2 here: JavaScript API Tutorial). Also, make sure the quick filter is a single select dropdown filter.


          I hope this helps!



          • 2. Re: Set a quick filter using Tableau API
            Jeff D

            Hi James, have you tried running with your browser's debugging tools enabled?  If you display the console window, it's likely there will be some clues as to why this isn't working.

            • 3. Re: Set a quick filter using Tableau API

              Using a single select may work but isn't applicable to the need.


              The power for the user is to evaluate many situations and criteria and see the differences.  If the selection involves something like race, ethnicity or special education, more than one category applies.  If it relates to discipline, the user may want evaluate in-school and off-campus suspensions together or separate from twenty other types of incidents.


              I am not sure what I'd be looking for in the console window Jeff.  The program gives the correct answer in the drop-down, it simply doesn't initiate a click.