<% lvl=validate(0) if showlastdays>0 then condition=" WHERE requestdate>='" & getlogin(dateadd("d",now,-showlastdays))&"'" psql="SELECT xlaALSDepts.deptid, xlaALSDepts.deptname, Count(xlaALSRequests.requestid) AS totalrequests FROM xlaALSDepts INNER JOIN xlaALSRequests ON xlaALSDepts.deptid = xlaALSRequests.deptid "&condition&" GROUP BY xlaALSDepts.deptid, xlaALSDepts.deptname" psqlmax="select max(totalrequests) as maxtotal, sum(totalrequests) as sumrequests from ("&psql&") derivedtbl" set conn=server.createobject("ADODB.Connection") conn.open connection set rs=conn.execute(psqlmax) if rs.eof then rs.close set rs=nothing conn.close set conn=nothing response.write "

 

 

No Graphic Available

" response.end end if maxtotal=rs("maxtotal") sumrequests=rs("sumrequests") if maxtotal>0 then scalingfactor=1/maxtotal else scalingfactor=0 if sumrequests>0 then percentfactor=1/sumrequests else percentfactor=0 response.buffer=true response.flush %> Absolute Live Support : Requests per Department <% set rs=conn.execute(psql) c=0 do until rs.eof c=c+1 if c>4 then c=1 deptname=rs("deptname") deptid=rs("deptid") totalrequests=rs("totalrequests") imgwidth=int(totalrequests*scalingfactor*240) percentage=formatnumber(totalrequests*percentfactor*100,1) %> <% rs.movenext loop rs.close set rs=nothing conn.close set conn=nothing %>
<%=deptname%> <%=percentage%>% <%=totalrequests%>