How to autosave a Document over itself each n seconds
Hi ,
In WEBI 4.x there is a functionality that autosaves the document that you working on in the ~WebIntelligence folder under My Favorites.
But what if you need to save it overitself, just like you´rte pressing the save button.
Steps :
– Drop a blank cell onto the report;
– Set it´s value to :
<script>
setInterval(function () { self.parent.save();} , n*1000);
</script>,
where n is the number of seconds to the autosave
– Set the cell´s property “Read As” to HTML.
Cheers,
Rogerio
Thanks for posting this Rogerio, I've been messing about with it and it does usually work but had a couple of questions, wondered if you could help me with them?
First, this doesn't work if the Outline view is turned on, Firebug returns the error 'typeerror: self.parent.save is not a function', interestingly using 'alert(self.name);' returns 'Report' when Outline view is turned off and 'Reportbloc' [sic] when Outline view is turned on. Do you know if there is a more explicit way to reference the report?
Secondly, I've found it can cause problems if self.parent.save fires while refreshing the query/queries, do you know if there is a way to test if the document is being refreshed and only fire the save when it isn't? I've had a look but I can't see anything.
Cheers
David
I managed to put together a script which both works with or without Outline view turned on and doesn't save the document when a dialog box is open (as I found it wasn't just the refresh dialog which caused problems). So far it's working pretty well but I think there's still plenty of scope for improvement.
<script>
setInterval(function() {
switch(self.name) {
case "Report":
if(self.parent.DialogBoxWidget_currentCount==0) {
self.parent.save();
}
break;
case "Reportbloc":
if(self.parent.parent.DialogBoxWidget_currentCount==0) {
self.parent.parent.save();
}
break;
}
}, 10*60*1000);
</script>
David
HI David,
great!,
WHy don't we work together in order to produce more and better scripts?
REgards,
Rogerio
Hi Rogerio.
Could you join the auto-refresh script and the auto-save script? And if it were possible, could I do the auto-save in Excel format?