Anyway to display a countdown timer in SSRS report?
-
13. dubna 2012 19:34
I have a simple question, does anyone know a way to display a countdown timer in a report? The report will be viewed via the SSRS viewer web part within sharepoint, but along with the static information displayed on the report I want to display a countdown timer which shows a countdown to the next event and i want it to be active (e.g. the user can see it counting down the seconds and minutes till this next event is scheduled).
I know this would involves somehow some javascript, but the only javascript i've seen embedded within reports is for linking. Anyone have any ideas on this. I thought about linking to an image to do the trick or something like that, but haven't quite figured this out yet.
Thoughts?
Všechny reakce
-
13. dubna 2012 19:41
see the link below. give it a whirl. let us know if it helps you out.
-
13. dubna 2012 19:58Interesting idea, will have to think this through. If anyone comes across any simple examples of this, would love to see it in action.
-
16. dubna 2012 7:11Moderátor
Hi BeckerBen2,
Here is a small javascript code to display countdown time on the webpage, we can embed it into SSRS report as BI Baracus mentioned:
<html>
<head>
<title> Countdown time</title>
</head>
<body>
<div>[clock2]</div>
</body>
<script>
countdown_start("timer","07/29/2009 2:00 PM")
function countdown_start(divid,givendate)
{
var given_date = new Date(givendate);
var cur_date = new Date();
diff = new Date(given_date - cur_date);
secs = Math.floor(diff.valueOf()/1000);
count_back(divid,secs);
}
function calculate(secs, num1, num2)
{
s = ((Math.floor(secs/num1))%num2).toString();
if (s.length < 2)
{
s = "0" + s;
}
return (s);
}
function count_back(divid,secs)
{
var output;
var format = "%%D%% Days %%H%%:%%M%%:%%S%%";
output = format.replace(/%%D%%/g,calculate(secs,86400,100000));
output = output.replace(/%%H%%/g,calculate(secs,3600,24));
output = output.replace(/%%M%%/g,calculate(secs,60,60));
output = output.replace(/%%S%%/g,calculate(secs,1,60));
if(secs > 0)
{
document.getElementById(divid).innerHTML = output;
setTimeout("count_back('" + divid + "'," + (secs-1) + ");", 990);
}
else
{
document.getElementById(divid).innerHTML = "Auction Over";
}
}
</script>
</html>Lola
TechNet Community Support
Please remember to mark the replies as answers if they help.
-
16. dubna 2012 11:20
Yeah, sounds good in theory, but I don't think this will work. I experimented with some very basic injecting of HTML using these methods and they do not work. I do not think it is possible to implement any custom html using these methods. I think the only HTML control one will have in a report will be via formatting as HTML within a textbox which is restricted to just a handful of controls.
If anyone can show me a working example of these methods, would love to see it, right now I can't create one nor find one. Logically they sound like they should work, but they do not in reality!