%@ LANGUAGE="VBScript" %> <% timedate=Request("timedate") Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd If timedate="" Then SQLStmtX = " select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') timedate from dual " Set RSX = Connection.Execute(SQLStmtX) timedate = CStr(RSX("timedate")) Set RSX=nothing End If ' response.write(SQLStmtX) If Not IsDate(timedate) Then message="Wrong Time/Date format " & timedate %> <% End If timedate_par=replace(timedate," ","%20") %>
<%
SQLStmt = " select to_char(lhv.logdate,'MM/DD/YYYY hh24:mi:ss') ddate, "
SQLStmt = SQLStmt & " 24*60*(to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-lhv.logdate) ddif, "
SQLStmt = SQLStmt & " lhv.logdate,lhv.hv_group,lhv.hv_channel,to_char(lhv.v_meas,'9999.9') v_meas,to_char(lhv.i_meas,'9999.9') i_meas,to_char(lhv.v_req,'9999') v_req,lhv.enabled "
SQLStmt = SQLStmt & " from phoffline.lecroy_hv lhv, "
SQLStmt = SQLStmt & " (select max(logdate) logdate,hv_group,hv_channel "
SQLStmt = SQLStmt & " from phoffline.lecroy_hv "
SQLStmt = SQLStmt & " where logdate between to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-2 and to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')"
SQLStmt = SQLStmt & " group by hv_group,hv_channel) sc "
SQLStmt = SQLStmt & " where lhv.logdate=sc.logdate "
SQLStmt = SQLStmt & " and lhv.hv_group=sc.hv_group "
SQLStmt = SQLStmt & " and lhv.hv_channel=sc.hv_channel "
SQLStmt = SQLStmt & " order by lhv.hv_group,lhv.hv_channel "
Set RS = Connection.Execute(SQLStmt)
' response.write(SQLStmt)
%>
HV Group | HV Channel | Graph | Last DB write | V Measured | V Requested | I Measured | Status |
<%=RS("hv_group")%> | <%=RS("hv_channel")%> | <% If CDbl(RS("ddif"))<=390 Then 'measurement is less than 6 hours and 30 minutes old Response.write("" & CStr(RS("ddate")) & "") Else Response.write("" & CStr(RS("ddate")) & "") End If %> | <%=Trim(RS("V_Meas"))%> | <%=Trim(RS("V_req"))%> | <%=Trim(RS("I_meas"))%> | <% If CInt(RS("enabled"))=1 Then 'channel is enabled Response.write(" Enabled ") Else Response.write(" Disabled ") End If %> |
<% Connection.Close Set Connection=nothing %>