2 Replies Latest reply on Sep 8, 2016 6:38 AM by Shiva Prakash Y V

    Tableau Server Data Refresh settings for the Front End Web Portal

    Shiva Prakash Y V

      Hi All,

       

      Let me explain the structure - First I have built Viz's (Reports) for my client which he can access from our front end web portal. Now the data gets accumulated every day. That is the new data flows only once in a day.

       

      Question - Whenever the client opts for new report the query is run to the database and then the report is viewed (which takes a lot of time) as there are many calculations.  What I need is the data should refresh automatically once in 2 hours or so but the Viz will remain the same. Let the Viz refresh once in 4 hours or so cos It is not going to change for the entire day.

      So, My question is how do I make those changes in Tableau Server.

       

      I tried choosing 'Refresh less often' option but that does not refresh the data regularly and hence I need to manually click refresh data button on the front end. I do not want my client to click refresh Data every time he loads the report. So Can you please suggest me how to make these changes ?

       

      Thanks!

        • 1. Re: Tableau Server Data Refresh settings for the Front End Web Portal
          Tharashasank Davuluru

          Hi Shiva,

           

          In Server we can use the Tableau JavaScript API to do the refreshing for us. (Note: JavaScript API does not work for Desktop.) Here’s the script Hugh put together to refresh data every 3 seconds (3,000 milliseconds).

          <!DOCTYPE html>
          <html lang=”en”>
          <head>
          <title>Tableau JavaScript API</title>
          <script type=”text/javascript” src=”https://online.tableausoftware.com/javascripts/api/tableau_v8.js“></script>
          </head>
          <body>
          <div id=”tableauViz”></div>

          <script type=’text/javascript’>
          var placeholderDiv = document.getElementById(“tableauViz”);
          var url = “https://online.tableausoftware.com/t/shawnwallworktableauonline/views/AutoRefreshTest/Dashboard1“;
          var options = {
          hideTabs: true,
          width: “100%”,
          height: “1000px”
          };
          var viz = new tableauSoftware.Viz(placeholderDiv, url, options);

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

          </script>
          </body>

          Replace the parts in bold with your own specifics and you’re good to go. Also if you change that third line from the bottom to 300,000 it will refresh every 5 minutes.

          As long as you have a fairly quick data connection this is the best solution. However, if you have a slow data connection like I was dealing with, then Bill came up with a clever idea for dealing with this situation. He reasoned that if we pre-load several tabs with our views and then use an AutoHotKey script to cycle through the tabs, then the slow loading pages would load before they reached the view position. And he was right. I ended up using a modified version of his script to cycle through 16 tabs, and most of the time the pages do load prior to being cycled into view (yes this particular database is a real dog).

          The added benefit of this approach is that you can rotate through several different dashboards/views. Here’s Bill’s latest version of his script. Just make sure to add the ?:refresh=yes parameter to the end of your URLs in the Excel file or your data won’t get refreshed, just your views will be refreshed.

          EDIT: And for an extra bonus, I found this post by Tableau’s Jordan Bunker Rotating Dashboard Display He uses Javascript to rotate through dashboards listed in a csv file, similar to what Bill did in his AHK script. It doesn’t look like Jordan is refreshing the data, just rotating the views.

           

           

           

          thi document will help you in a better wayTinkering with Data Refresh & Auto-Refresh « Tableau Tinkering

          • 2. Re: Tableau Server Data Refresh settings for the Front End Web Portal
            Shiva Prakash Y V

            Hi Tharashasank,

             

            Thanks for taking time to write a detailed explanation. It is actually useful for a data which needs to be refreshed every now and then.

            This is not my issue. I need the VIZ to be in cache for a day and then refresh the data. There are settings in the tableau Server which can be fine tuned. I am expecting some of that to be tinkered around for what I need.

             

            Thanks again!