smurfy
12-01-2002, 08:16 PM
Hi all.
Can't give a link to this as it's on a secure intranet but here is my code so far:
<HTML>
<HEAD>
<meta http-equiv="refresh" content="300">
</HEAD>
<BODY topmargin="10" leftmargin="10">
<%
dim i
dim cellString
dim callsthr
dim TodayDate
dim dbConn
dim sqlstr
dim results
dim snap_date_calc_day
dim snap_date_calc_month
dim snap_date_calc_year
dim snap_date_calc
If Day(Now()) < 10 then
snap_date_calc_day = "0" & Day(Now())
else
snap_date_calc_day = Day(Now())
End If
If Month(Now()) < 10 then
snap_date_calc_month = "0" & Month(Now())
else
snap_date_calc_month = Month(Now())
End If
snap_date_calc_year = Year(Now())
snap_date_calc = snap_date_calc_day & "/" & snap_date_calc_month & "/" &snap_date_calc_year
TodayDate = snap_date_calc
callsthr = 97.5
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open "Provider=SQLOLEDB.1;Server=@@@@@@;Database=@@@@@;User ID=######;Password=#####"
sqlstr = "Select snap_skill AS 'SKILL', max(snap_time) AS 'TIME', (((sum(cc_fact.calls_offered)-sum(cc_fact.abandoned))/sum(cc_fact.calls_offered))*100.0/1) AS 'OFFERED' FROM cc_fact WHERE snap_origin = ''" & TodayDate & "' GROUP BY snap_skill"
Set results = dbConn.Execute(sqlstr)
if results.eof then
response.write("Sorry, there is no Data present.")
else
%>
<table border=1>
<th colspan=14>Calls not abandoned after threshold by skillgroup as at <%=results("TIME")%> with threshold variable: <%=callsthr%>%</th>
<tr>
<%
dim percentage
dim score
dim target
i = 1
do until results.eof
score = CDbl(results("OFFERED"))
target = CDbl(callsthr)
If score < target Then
percentage = score
ELSE
percentage = target
End if
if percentage <> score then
cellString = "<td>" & results("SKILL") & "</td><td bgcolor='Lime'>" & results("OFFERED") & "</td>"
else
cellString = "<td>" & results("SKILL") & "</td><td bgcolor='Red'>" & results("OFFERED") & "</td>"
end if
if not i mod 7 = 0 then
response.write(cellString)
else
response.write(cellString)%></tr><%
end if
i = i + 1
results.movenext
loop
%>
</table>
<%
end if
%>
<SCRIPT LANGUAGE="JavaScript">
var titlechange;
var pagetitle = "CCDash ";
function scroll()
{
today = new Date();
sec = today.getSeconds();
var titlechange = "Count :" + sec;
pagetimer = setTimeout("scroll()", 5000);
document.title = pagetitle + titlechange;
}
if (document.all) scroll();
</script>
</BODY>
</HTML>
Now what this all does is queries a database every 5 minutes returning 7 sets of data (2 result items per set) to a table 14 columns wide.
Not only that, the "OFFERED" result cell is conditionally formatted (bgcolor) depending on the comparison of the result to the target figure.
That all works fine.
What I want to do now though is a little more tricky.
See my little document.title javascript at the bottom?
That was a test to make sure I can change the document title (this is all done within a Microsoft only environment so I don't care that Netscape etc won't allow doc title to be changed from body).
What I actually want to do is scroll through my result set from the query in the title bar!
As my query vbscript is server-side and changing titlebar is client side javascript I can't see how I can do it...
I've got a vague idea that I can perhaps NAME the table CELLS that the result sets are populating and use those names in some sort of loop to change the "titlechange" variable in the javascript.
Is that possible?
Can't give a link to this as it's on a secure intranet but here is my code so far:
<HTML>
<HEAD>
<meta http-equiv="refresh" content="300">
</HEAD>
<BODY topmargin="10" leftmargin="10">
<%
dim i
dim cellString
dim callsthr
dim TodayDate
dim dbConn
dim sqlstr
dim results
dim snap_date_calc_day
dim snap_date_calc_month
dim snap_date_calc_year
dim snap_date_calc
If Day(Now()) < 10 then
snap_date_calc_day = "0" & Day(Now())
else
snap_date_calc_day = Day(Now())
End If
If Month(Now()) < 10 then
snap_date_calc_month = "0" & Month(Now())
else
snap_date_calc_month = Month(Now())
End If
snap_date_calc_year = Year(Now())
snap_date_calc = snap_date_calc_day & "/" & snap_date_calc_month & "/" &snap_date_calc_year
TodayDate = snap_date_calc
callsthr = 97.5
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open "Provider=SQLOLEDB.1;Server=@@@@@@;Database=@@@@@;User ID=######;Password=#####"
sqlstr = "Select snap_skill AS 'SKILL', max(snap_time) AS 'TIME', (((sum(cc_fact.calls_offered)-sum(cc_fact.abandoned))/sum(cc_fact.calls_offered))*100.0/1) AS 'OFFERED' FROM cc_fact WHERE snap_origin = ''" & TodayDate & "' GROUP BY snap_skill"
Set results = dbConn.Execute(sqlstr)
if results.eof then
response.write("Sorry, there is no Data present.")
else
%>
<table border=1>
<th colspan=14>Calls not abandoned after threshold by skillgroup as at <%=results("TIME")%> with threshold variable: <%=callsthr%>%</th>
<tr>
<%
dim percentage
dim score
dim target
i = 1
do until results.eof
score = CDbl(results("OFFERED"))
target = CDbl(callsthr)
If score < target Then
percentage = score
ELSE
percentage = target
End if
if percentage <> score then
cellString = "<td>" & results("SKILL") & "</td><td bgcolor='Lime'>" & results("OFFERED") & "</td>"
else
cellString = "<td>" & results("SKILL") & "</td><td bgcolor='Red'>" & results("OFFERED") & "</td>"
end if
if not i mod 7 = 0 then
response.write(cellString)
else
response.write(cellString)%></tr><%
end if
i = i + 1
results.movenext
loop
%>
</table>
<%
end if
%>
<SCRIPT LANGUAGE="JavaScript">
var titlechange;
var pagetitle = "CCDash ";
function scroll()
{
today = new Date();
sec = today.getSeconds();
var titlechange = "Count :" + sec;
pagetimer = setTimeout("scroll()", 5000);
document.title = pagetitle + titlechange;
}
if (document.all) scroll();
</script>
</BODY>
</HTML>
Now what this all does is queries a database every 5 minutes returning 7 sets of data (2 result items per set) to a table 14 columns wide.
Not only that, the "OFFERED" result cell is conditionally formatted (bgcolor) depending on the comparison of the result to the target figure.
That all works fine.
What I want to do now though is a little more tricky.
See my little document.title javascript at the bottom?
That was a test to make sure I can change the document title (this is all done within a Microsoft only environment so I don't care that Netscape etc won't allow doc title to be changed from body).
What I actually want to do is scroll through my result set from the query in the title bar!
As my query vbscript is server-side and changing titlebar is client side javascript I can't see how I can do it...
I've got a vague idea that I can perhaps NAME the table CELLS that the result sets are populating and use those names in some sort of loop to change the "titlechange" variable in the javascript.
Is that possible?