1 2 3 4 Previous Next 51 Replies Latest reply on Jun 14, 2017 9:55 AM by Hugh Nguyen Go to original post Branched to a new discussion.
      • 15. Re: Auto Refreshing Live connected dashboard in Browser(through server)
        Bill Lyons

        I'm glad it could be helpful to you. Of course, I would always expect users of other people's code to tweak it as appropriate for their own environment. There could be differences in performance, browser versions, permissions, file locations, the information you want to display, etc. Examples carry no warranty of any kind .

         

        Just a few notes in response to your points:

        1. I am puzzled by the "URL" line skip causing "spinning." All that did was ignore the line and read the next line. On the very first time through the loop, there is no "previous" page showing to hide the refresh, so the only way to prevent that is to have some sort of static screen. In my case, I display an image as a sort of "splash screen" while the first Tableau viz loads. Of course, removing the line does no harm.
        2. If you have no other pages open, there is no functional difference between Ctrl-Tab and Ctrl-Shift-Tab. I tried both, and on my machine I could see no difference in performance. Your mileage may vary.
        3. Very good point about including ?:refresh=yes to the end of the URLs. Of course, my example merely rotated through a few Tableau blogs, but if you want fresh data to display in Tableau, as was the purpose of this thread from the beginning, you would definitely want the refresh. However, I suggest caution. In my case, some of the vizzes will need refresh, because the numbers change minute-by-minute. But the data in others only change daily or even monthly, so forcing a refresh is wasteful of resources in those cases.

         

        FWIW, I am also working on combining this technique with the javascript API, using javascript to step through story points in a viz. Basically, the URL in the csv file will be that of a page with javascript in it, and the time displayed will be appropriately longer.

         

        I especially appreciated this discussion because I am able to deploy it in production in real-life very quickly!

         

        bl

        • 16. Re: Auto Refreshing Live connected dashboard in Browser(through server)
          Shawn Wallwork

          Bill some more comments:

           

          #1 I'm not sure either. Each cycle would have one spinner/reload as it worked through your 3 URLs. When I took out the loop and deleted the header row, the spinner disappeared. I'll take another look at it later.

           

          #2 Because you didn't need to account for a login to Online or Server to rotate your websites, you didn't put in any code to account for the login. So I couldn't run your code without a browser open, and at least one of my dashboards pre-loaded.

           

          You're only using (assuming) 2 tabs. I'm working with a dog of a database, so I've found that if I preload all 3 dashboards into 3 different tabs and then fire off the AHK script I end giving the last tab loaded enough time to fully load before it get cycled into the display position. (And that's with a 20 sec. cycle time!) This is why for me there is a difference between the ctrl-tab and ctrl-shift-tab.

           

          #3 In my case the dashboards are all live, so the refresh is essential. But you are right, only use it when you have to.

           

          Cheers,

           

          --Shawn

          • 17. Re: Auto Refreshing Live connected dashboard in Browser(through server)
            Ranadheer Kovvuri

            Thank You Very Much Hugh,It worked ..

             

             

            Thanks A ton

            • 19. Re: Auto Refreshing Live connected dashboard in Browser(through server)
              Bill Lyons

              Re: #2 - You are correct about the authentication issue. I wrote mine to work with our Tableau Server, which uses AD authentication on our internal network. For other purposes, you would definitely need to add an authentication piece. Since I don't have a specific example to program to, the best I could do is insert a couple of comments with suggested locations for authentication code. Sorry I can't be more helpful there.

               

              In reading your need to preload more pages, I realized that would benefit me as well, and it would only take a few tweaks to the script to preload 3, 4 or even more tabs. So, I wrote that into the code, with a configuration value for the desired number of tabs at the top. In that case, you definitely want to use Ctrl-Tab to switch back to the first in the sequence.

               

              Then, I thought, what if we just load ALL of the pages, and cycle them? Then, the page needs a reload command (Ctrl-F5), followed by the tab-advance (Ctrl-Tab). That also opened the possibility of directing it to NOT reload the page (in case the page is static, as some of my images are). So, I added that as an option, with a third value in the row. If not specified, it defaults to "yes" meaning reload the page. Anything else with prevent the page reload. I also changed the code from skipping the header "URL" row, to skip any row beginning with a semicolon (the comment character in Autohotkey). Essentially, this means you can "comment out" a line temporarily. If for some reason that doesn't work for you, remove it.

               

              So, now both options are available, and determined by the value of the "DesiredNumberOfTabs" setting, as indicated in the comments. I actually like the tabs-never-close method a little better - it doesn't even show a little flash between screens, at least on my machine. Of course, the viability of this method depends on the number of pages you intend to rotate.

               

              Of course, as always, your mileage may vary , timings and other tweaks may be necessary, depending on your environment. I hope this is helpful. I know it is an improvement for my needs.

               

              Is there a better place to publish this for others? It doesn't seem appropriate in the Calculation Reference Library or the Workbook Library, since it is neither a workbook, nor a calculation. Suggestions are appreciated.

               

              bl

              • 20. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                Shawn Wallwork

                Thanks Bill for the tweaks. I'll give them a try. One thing you mentioned doesn't work the way you think it does:

                 

                Then, I thought, what if we just load ALL of the pages, and cycle them? Then, the page needs a reload command (Ctrl-F5), followed by the tab-advance (Ctrl-Tab).

                 

                Sending an F5 keystroke only refreshes the browser, it does NOT refresh the data, (like it does in Desktop). The only way I could find to refresh the data in a browser was to use the URL parameter, or do it in a JavaScript.

                 

                Adding the number of tabs to open is a cool new feature, as we are finding that preloading as many as 15 gives us the best chance of avoiding the spinner.

                 

                Cheers,

                 

                --Shawn

                • 21. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                  Bill Lyons

                  I'm sorry I wasn't clear. I never meant to imply that the page reload command refreshes the data. It merely forces the browser to resend the URL command to the server. If all the tabs remain open, and you merely switch from tab to tab, the URL command is never resent to the server. Even if the URL contains the &:refresh=yes command, if it is never sent to the server, it will never be acted upon to refresh the data. Thus the need for both the URL refresh parameter AND the page reload.

                   

                  It is also worth noting that F5 alone may allow the browser to just reload the page from the internal browser cache. Ctrl+F5 or Shift+F5 forces ignoring the local cache and reloading from the server.

                   

                  As for the limit of preloaded pages, Chrome will open as many as memory will allow. I have seen people say they have 80 or more open tabs simultaneously on a 16 GB machine.

                   

                  Another caution: with this method, the page reload happens when you leave the page. If it takes a half-hour to cycle through all of your pages, the next time you see it the data will be a half-hour old! This is where the Javascript refresh technique has a significant advantage.

                   

                  Use whichever method best suits your desired refresh interval and number of pages being displayed.

                   

                  bl

                  • 22. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                    Shawn Wallwork

                    Bill Lyons wrote:

                    It is also worth noting that F5 alone may allow the browser to just reload the page from the internal browser cache. Ctrl+F5 or Shift+F5 forces ignoring the local cache and reloading from the server.

                     

                    In Chrome none of these refresh the data: F5, Ctrl+F5 and Shift+F5 They only refresh the browser. They do NOT force the browser to ignore the internal browser cache. At least they don't on any of the Servers I just tested.

                     

                    --Shawn

                    • 23. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                      Bill Lyons

                      I'm just basing my comments on Keyboard shortcuts - Chrome Help, in which it says:

                      F5 or Ctrl+RReloads your current page.
                      Ctrl+F5 or Shift+F5Reloads your current page, ignoring cached content.

                       

                      If that isn't true, then I guess Google is lying to us...

                       

                      bl

                      • 24. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                        Shawn Wallwork

                        There appears to be a difference between 'browser' cache, and Tableau cache.

                         

                        --Shawn

                        • 25. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                          Shawn Wallwork

                          This thread inspired me! Here's the blog post: Tinkering with Data Refresh & Auto-Refresh « Tableau Tinkering Thanks Huge and Bill for the contributions, and education.


                          Cheers,


                          --Shawn

                          • 26. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                            Bill Lyons

                            Excellent blog post. Thank you for the mention!

                             

                            In the middle of the night last night, I had an idea on combining the two techniques: preloading slow pages, and using the Javascript API. Be looking for an update this week if that idea works.

                             

                            I am curious about the licensing comment from Russell Christopher. I reread the license agreement, and I find nothing that says that. Can someone point me to the specific language?

                             

                            bl

                            • 27. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                              Shawn Wallwork

                              Just got a note from Russell. Turns out that was a policy that was discussed but not adopted. So rotate/refresh away.

                               

                              Cheers,

                               

                              --Shawn

                              • 28. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                                Kamini Sugumar

                                Hi,

                                 

                                Am trying to implement a similiar auto refresh for a Live connected Dashboard in Tableau.

                                I used the ahk script to refresh but my requirement is to refresh  the Dashboard every 5 mins.

                                Am unable  to edit the ahk script....Cana someone pls help.

                                 

                                Also how does the javascript code work and describe steps to implement it.

                                 

                                Thanks,

                                Kamini

                                • 29. Re: Auto Refreshing Live connected dashboard in Browser(through server)
                                  Ranadheer Kovvuri

                                  Try using the below HTML code Hugh posted.

                                   

                                  Copy the below code to a notepad

                                   

                                  Replace the links with your server name  (   "http://servername/javascripts/api/tableau_v8.js"></script>)   and the viz link  (  "http://servername/t/311/views/Mayorscreenv5/MayorScreenv2";)  generated from the server .And set the time interval to refresh it  ("setInterval(function () {viz.refreshDataAsync() }, 3000);"   ) its in milli seconds (1 sec= 1000 milliseconds ). Save the file with ". html" extension  and open it in a browser.The page keeps refreshing it self in the time interval you set.

                                   

                                   

                                   

                                  <!DOCTYPE html>

                                  <html lang="en">

                                    <head>

                                    <title>Tableau JavaScript API</title>

                                    <script type="text/javascript" src="http://servername/javascripts/api/tableau_v8.js"></script>

                                    </head>

                                    <body>

                                    <div id="tableauViz"></div>

                                   

                                  <script type='text/javascript'>

                                  var placeholderDiv = document.getElementById("tableauViz");

                                    var url = "http://servername/t/311/views/Mayorscreenv5/MayorScreenv2";

                                    var options = {

                                      hideTabs: true,

                                      width: "100%",

                                      height: "1000px"

                                    };

                                    var viz = new tableauSoftware.Viz(placeholderDiv, url, options);


                                  setInterval(function () {viz.refreshDataAsync() }, 3000);

                                   

                                  </script>

                                  </body>

                                  </html>

                                   

                                   

                                   

                                   

                                   

                                  Let me know,if this has worked out for you

                                   

                                   

                                  Best

                                  Rana