4 Replies Latest reply on Apr 17, 2018 11:29 PM by nadav.luboshitz.0

    Tableau api Getting Filter Values

    Quin Thames

      Hello Everybody,

       

      I'm trying to figure out how to change filter values in an imbedded Tableau view.  I have been able to do it how the tutorial does it JavaScript API Tutorial -

       

      //On a filter called region with values Europe, Middle East, The Americas, Oceania, Asia, Africa

      function filterSingleValue() {

        activeSheet.applyFilterAsync(

        "Region",

        "The Americas",

        tableauSoftware.FilterUpdateType.REPLACE);

      }

       

      But this requires you to know the exact name of the filter value ("The Americas") that you want to change the filter to.  How can you do this if you don't know the exact filter value names?  I looking for a function thats something like:

      values = activeSheet.getFilterValues("Region");

      That would return a list of options for the filter (ie: Europe, Middle East, The Americas, Oceania, Asia, Africa)

       

      Is there a function like this that exists? Or another way to do it?

        • 1. Re: Tableau api Getting Filter Values
          Russell Christopher

          Hey Quin -

           

          No, you need to know the correct string (like "The Americas") to filter with, and there is no method to list potential values for you to work with.

           

          Curious though - for the sake of arguement, let's say there was - how would you actually use it? How would your code move through this list and pick the "right stuff" to filter with if you don't know what is going to be in that list in the first place?

           

          Regards!

          • 2. Re: Tableau api Getting Filter Values
            Quin Thames

            Well I was wondering if it were possible to pull those values out to create a Html selector on the page while hiding the filter dropdown in the Tableau View.  That way I could programmatically determine which filter options a specific user is able to select and not offer other specific filter options.

            • 3. Re: Tableau api Getting Filter Values
              Jesse Taylor

              This is a non-answer. I'm wanting to do the exact same thing. How would I use it? A field has a list of available values. All I want to be able to do is retrieve that list of available values without having to know them beforehand, why? Because it would allow for me to expose those values outside of the iframe so they can match the style and responsiveness of a site, but don't have to be hardcoded into the CMS that the site is built in. They would be exposed in the form of a select list form element and allow the end user to filter on any of the available values.

               

              You ask how would we know what the right stuff is? Because it exists as an available value.

              • 4. Re: Tableau api Getting Filter Values
                nadav.luboshitz.0

                Hey Quin Thames Jesse Taylor Russell Christopher

                I'm trying to do the same thing exactly - having HTML filters outside of the Iframe.

                So far I managed to load the currently-selected values from a filter but not all the values in the Data-Source.

                 

                Did you have any progress with that?

                 

                Thanks