3 Replies Latest reply on Aug 3, 2015 4:33 PM by Russell Christopher

    Java Script API with multiple URLS

    Nicholas Papiri

      Has anyone had any experience using the JavaScript API with multiple URLS? I have a dashboard that refreshes data every 30 seconds using the following basic script:

      <html>
      <head></head>
      <body>
      <script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript"> 
      function initializeViz() {
      var placeholderDiv = document.getElementById("tableauViz");
      var url = "http://ccapptabdev01/t/Gas/views/SCADA_SERVER_DASHBOARD/Dashboard1";
      var options = {
      width: 2000,
      height: 1200,
      hideTabs: true,
      hideToolbar: false,
      onFirstInteractive: function () {
      workbook = viz.getWorkbook();
      activeSheet = workbook.getActiveSheet();
      }
      };
      viz = new tableauSoftware.Viz(placeholderDiv, url, options);
      }  $(initializeViz);
      </script><script type="text/javascript"> 
      function RefreshViz(){ 
      / viz.refreshDataAsync(); }if (document.addEventListener)
      {window.addEventListener("load", RefreshViz, false);
      } else if (document.attachEvent){window.attachEvent("onload", RefreshViz); }
      setInterval(RefreshViz, 30000); 
      </script>
      <div id="tableauViz"> 
      </div>
      </body>
      </html>
      

       

      I'd like to do the same thing with 2 or three different URL's such that the dashboard rotates every 30 seconds, refreshes the data from the server, and displays the new URL with fresh data.

       

      Has anyone worked with Java and Tableau API to do this yet?? I have searched everywhere, and even attempted to do this here: jsfiddle.net/39eo3to2/45

      However it doesn't work quite right....

       

      Any help would be greatly appreciated!