6 Replies Latest reply on Apr 16, 2018 3:45 PM by ankit.ravi

    Export the current filtered sheet using export button from server

    ankit.ravi

      I am trying to create a report where in the attached image(I am sorry I have to shade out all the dimensions and the measure headers), where lets say when the user clicks on date, the following reports beneath it get filtered. Basically use date as a filter, then when someone clicks on the filtered campus report which would act as a filter for the reports beneath it and so on.

       

      Basically I am trying to create a hierarchy and filter based on it. The issue is I want to provide the use with a feature wherein they can download the data for the desired filtered report from the server. I have created buttons for the same and provided the URL path :

      tabelauserver/#/site/sitename/workbookname/dashboard.csv

       

      The issue is when i download the reports after applying filters it is still returning me the original data and not the filtered data. It is not referencing to the active(current) sheet while downloading it.

       

      I am currently using tableau 10.2 server.


      Can someone please let me know if there is a way to this this on tableau or using JS? Also, please do let me know if you need any additional information on this.

       

       

       

      Thanks

      Ankit

        • 1. Re: Export the current filtered sheet using export button from server
          Joe Oppelt

          You can add your filter and parameter values to the URL string.

           

          I recently gave a detailed response to someone else about this in this thread:

           

          How to Export filtered view from a tableau dashboard

           

          In that thread the example I gave was just passing parameter values (which are always single-value entities).  Grabbing the values of filters can get a bit more complicated.  If you need to do that, we can discuss some ideas.

          • 2. Re: Export the current filtered sheet using export button from server
            ankit.ravi

            Hey Joe,

            I did go through couple of threads before creating this one. I believe this case is bit different wherein I am using report(sheet1) in the dashboard as a filter for other reports contained in it. So I am not explicitly applying the filter, the sheet1 is the filter here.

             

            Can you please help me with how I can utilize the values of filter in the url?

             

            Do you think we can do this using the same approach as mentioned by you? I tried couple of things it did not work.

            • 3. Re: Export the current filtered sheet using export button from server
              Joe Oppelt

              You can build a string of the selected dimensional values.  It would be kind of specific to your sheet, but the logic goes something like this:

               

              WINDOW_MAX(

              IF INDEX() = 1 then ATTR([dimension name])

              else

              PREVIOUS_VALUE(" ") + "," + ATTR([dimension name])

              END

              )

               

              The stuff in the parentheses of the WINDOW_MAX is building a string of all the dimension values (of the specified dimension) on the sheet.  The first part puts the first dimension value, and the second half keeps appending a comma and the next name.

               

              (Note: If your dimension is a numeric field, wrap each reference to the dimension in the STR() function.  You have to pass a string value in the URL.)

               

              First play with that inner portion of the calc.  Take a dummy sheet that simulates what you'll end up with on your dashboard and put that calc on the sheet.  You'll see the calc "grow" as it works down the dimensions on the sheet.

               

              The WINDOW_MAX will capture the ending value because that's what you really want.

               

              So, as you can see, I said that grabbing the filter values is a bit more complicated.  By the way, we aren't really grabbing the actual filter selections.  We are grabbing the values that end up on the sheet.  It's a technical distinction, and usually the end result is the same.  But we don't have actual access to the filter structure.  We only have access to the resulting data on the sheet.

               

              Once you build this string, you plug that into URL string in the same way I demonstrated in the referenced link.  There are some nice links out there that describe this method in more detail.

               

              One final note:  My hope is that your resulting URL string doesn't exceed some URL buffer limit.  I recently saw a post on the forum with someone reporting that happening.  I didn't see the resolution to it though.  I have never blown a limit, so I haven't had to investigate this, and I don't know who sets the limit or what that limit is.

              • 4. Re: Export the current filtered sheet using export button from server
                ankit.ravi

                Thanks Joe for the this, I will try it out and let you know if this works in my case.

                 

                Thanks

                • 5. Re: Export the current filtered sheet using export button from server
                  ankit.ravi

                  Hey Joe,

                  So this is what I am looking for, I want to use the action filters (in my case Date(worksheet) is one of the action filters). Is there a way where I can use it in the url?

                  • 6. Re: Export the current filtered sheet using export button from server
                    ankit.ravi

                    I have filed a ticket with tableau support regarding the same. Will update once I have something from them.

                     

                    Thanks