Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
refresh BIRT Report to next page
birtprofi
<p>Hello,</p><p> </p><p>I have a question. I know it is possible to refresh a birt report with javascript every "n" seconds. But is it also possible to refresh a report with for example 4 pages?</p><p> </p><p>First 20 sec show report page 1, then next 20 sec show report page 2 ....... when the last page is displayed, then start again with page 1</p><p> </p><p>Please give me your advices.</p><p> </p><p>best regards</p><p>rafael</p>
Find more posts tagged with
Comments
kclark
<p>You could use some JavaScript like this in a text item in the master page header.</p><pre class="_prettyXprint"><script> total = <value-of>totalPage</value-of>; current = <value-of>pageNumber</value-of> function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } sleep(10000); var currentURL = new String(); currentURL = document.URL; var removeThis = currentURL.indexOf("&__page="); if(removeThis > -1) { currentURL = currentURL.substring(0, removeThis); } var newPage = current + 1; if(newPage > total) { window.location = currentURL + "&__page=1"; }else{ window.location = currentURL + "&__page=" + newPage; }</script></pre>
birtprofi
<p>Hi kclark,</p><p> </p><p>thank your for your help. This solutions works perfect!</p>
birtprofi
<p>I am sorry but I have to open this topic again. I found one problem, but I don´t know why.</p><p>No matter how many milliseconds I put in the script, it seems that doesnt matter.</p><p> </p><p>The report always switch to the next page always after 1-2 seconds.</p><pre class="_prettyXprint">sleep(10000);</pre><p>What is the problem? The JS looks good. But even I put 100000 as value, its the same issue.</p><p> </p>
kclark
<p>Using jQuery you could use <a data-ipb='nomediaparse' href='
http://api.jquery.com/delay/'>delay()
</a></p>
birtprofi
<p>Hi,</p><p> </p><p>thank you for your assistance. Now I made a little modifcation and it works correct. This is actually the script to reload to next page with correct timer.</p><p>best regards</p><pre class="_prettyXprint _lang-js"> total = <value-of>totalPage</value-of>; current = <value-of>pageNumber</value-of> function reloadtonextpage() { var currentURL = new String(); currentURL = document.URL; var removeThis = currentURL.indexOf("&__page="); if(removeThis > -1) { currentURL = currentURL.substring(0, removeThis); } var newPage = current + 1; if(newPage > total) { window.location = currentURL + "&__page=1"; }else{ window.location = currentURL + "&__page=" + newPage; } }timer=setTimeout('reloadtonextpage()', 10000);</pre>
birtprofi
<p>Hi guys</p><p> </p><p>I need your help again with this topic. The JavaScript of my last post works fine. But actually I have a problem with the performance. My report is a crosstab with a lot of scritped background drawings each cell.</p><p> </p><p>If I call the report with "frameset" it needs about 1 minute to render. Then I click to the button "next page" -> the report show me immediatly the next page.</p><p> </p><p>But if I use the javascript instead, the report render again, and I have to wait 1 minute again to load page 2. This is too long time, because the report is linked to an info screen.</p><p> </p><p>My questions:</p><p>Question 1:</p><p>Do you know the javascript expression to change to next page without render again?</p><p> </p><p>Question 2:</p><p>Would it be faster, if I work with the .document file?</p><p> </p><p>My idea is, that maybe I could use the internal "next page" function, and after 1 hour, I load the complete link again to refresh my data.</p><p> </p><p>Best Regards</p><p>Rafael</p><p> </p><p> </p>
birtprofi
<p>any idea?</p><p> </p><p>I found something in the BirtNavigationBar.js. Maybe I could use something like that, to switch to next page with javascript:</p><pre class="_prettyXprint _lang-js">birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : pageNumber + 1 </pre><p>But because I am not so good in Javascript, I need your help.</p><p> </p><p>best regards</p><p>rf</p>
birtprofi
<p>Hi,</p><p> </p><p>I solved my issue. I use now a JS syntax from BirtNavigationBar.js</p><pre class="_prettyXprint _lang-js">birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : oGotoPage.value } );</pre><p>But instead of "oGotoPage.value" I use my newPage Variable</p><pre class="_prettyXprint _lang-js"> if(newPage > total) { //window.location = currentURL + "&__page=1"; birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : 1 } ); }else{ //window.location = currentURL + "&__page=" + newPage; birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : newPage } ); }</pre><p>In conclusion it looks very simple, but I´ve spend some time on it. Now the advantage is, that the reports refresh very fast, and also after some time I refresh the report with "window.location" to get the updated data.</p><p> </p><p>best regards</p>