Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

slideshow

To loop through pages automatically we need a javascript timer on each page to trigger an iron python script that changes to the next page.




html
<FONT size=6><SPAN>the iron python script switches to the next page</SPAN></FONT> 

<DIV id=switchPageBtn><SpotfireControl id="ff8993c967e049f580fed8aa9b25ec45" /></DIV>


js
$(function(){
clearTimeout(document.body.timeout);
document.body.timeout=setTimeout(function(){$('#switchPageBtn input').click();}, 3000)
});

script 
#current page number
cp = Document.Pages.IndexOf(Document.ActivePageReference)

#total pages
tp = Document.Pages.Count

#calculate next page
np = cp+1 if cp+1<tp else 0

#go to next page
Document.ActivePageReference = Document.Pages[np]


3 comments:

Unknown said...

Hi Jose ,

This is very useful . Thanks for posting.

Unknown said...

Hi Jose,

Excuse my inexperience, but how do you hook this thing up?

I imagine a bit of javascript is involved but i'm still pretty new to Spotfire.

Looks like a great solution

Jose Leviaguirre said...

Hello Bren,

Thanks for your comment. You need to be an script author to be able to implement this, which has two components; an iron python script that changes from page to page and a javascript to execute the iron python script every number of seconds.

To implement, just add a text area, edit it's html and paste the html code. Just replace the spotfire control with a spotfire button. Make sure the iron python script associated with the button actually works. It should switch to the next page.

Finally, add a javascript to the text area to automate the spotfire action control (button) clicking.