<%@ LANGUAGE="VBScript" %> <% Function GetIon(aa) Select Case aa Case 197 GetIon="Au" Case 1 GetIOn="p" Case -1 GetIOn="Undefined" Case Else GetIOn="A_" & CStr(aa) End Select End Function ' Dim runDefForm ' Set runDefForm = Document.forms("genrundef") Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd ' Connection.Open phdb_rd_repl SQLStmtx = "select to_char(sysdate,'DD Mon YYYY') ddate,to_char(sysdate,'HH24:MI:SS') ttime,global_name from global_name " ' response.write(SQLStmtx & "
" ) Set RSx = Connection.Execute(SQLStmtx) If Not RSx.EOF Then select case CStr(RSx("global_name")) case "PHDB.WORLD" dbname="Main Phobos Database" case "ORACLE.WORLD" dbname="Phobos Server (old) Database" case "KRPHOBOS.WORLD" dbname="Krakow Database" case "ROCHESTER.WORLD" dbname="Rochester Database" end select Else dbname="Undefined Database" End If progname = CStr(Request("genname")) ra1 = CStr(Request("a1")) ra2 = CStr(Request("a2")) re1 = CStr(Request("energy1")) re2 = CStr(Request("energy2")) rbmin = CStr(Request("bmin")) rbmax = CStr(Request("bmax")) aprocess = 0 If CInt(Request("a1")) > 0 And CInt(Request("a2")) > 0 Then aprocess = 1 End If eprocess = 0 If CInt(Request("energy1")) > 0 And CInt(Request("energy2")) > 0 Then eprocess = 1 End If bprocess = 0 If Round(Request("bmin"),4) > 0 Or Round(Request("bmax"),4) > 0 Then bprocess = 1 End If SQLStmt = " select mcr.run, " SQLStmt = SQLStmt & " nvl(t1.numvalue,-1) cbmin, " SQLStmt = SQLStmt & " nvl(t2.numvalue,-1) cbmax, " SQLStmt = SQLStmt & " nvl(t3.numvalue,-1) ce1, " SQLStmt = SQLStmt & " nvl(t4.numvalue,-1) ce2, " SQLStmt = SQLStmt & " nvl(t5.numvalue,-1) ca1, " SQLStmt = SQLStmt & " nvl(t6.numvalue,-1) ca2, " SQLStmt = SQLStmt & " to_char(mcr.run_date,'MM/DD/YYYY') rdate,mcr.program_name,mcr.num_events,mcr.run_type " SQLStmt = SQLStmt & " from phoffline.mcruns mcr, " SQLStmt = SQLStmt & " phoffline.mc_pars t1, " SQLStmt = SQLStmt & " phoffline.mc_pars t2, " SQLStmt = SQLStmt & " phoffline.mc_pars t3, " SQLStmt = SQLStmt & " phoffline.mc_pars t4, " SQLStmt = SQLStmt & " phoffline.mc_pars t5, " SQLStmt = SQLStmt & " phoffline.mc_pars t6 " SQLStmt = SQLStmt & " where " SQLStmt = SQLStmt & " mcr.program_name='" & progname & "'" If bprocess > 0 Then SQLStmt = SQLStmt & " and t1.keyname='BMIN' and abs(t1.numvalue-" & rbmin & ")<0.1" & " and t1.run(+)=mcr.run " SQLStmt = SQLStmt & " and t2.keyname='BMAX' and abs(t2.numvalue-" & rbmax & ")<0.1" & " and t2.run(+)=mcr.run " Else SQLStmt = SQLStmt & " and t1.keyname='BMIN'" & " and t1.run(+)=mcr.run " SQLStmt = SQLStmt & " and t2.keyname='BMAX'" & " and t2.run(+)=mcr.run " End If If eprocess > 0 Then SQLStmt = SQLStmt & " and t3.keyname='E1' and abs(t3.numvalue-" & re1 & ")<1.0" & " and t3.run(+)=mcr.run " SQLStmt = SQLStmt & " and t4.keyname='E2' and abs(t4.numvalue-" & re2 & ")<1.0" & " and t4.run(+)=mcr.run " Else SQLStmt = SQLStmt & " and t3.keyname='E1'" & " and t3.run(+)=mcr.run " SQLStmt = SQLStmt & " and t4.keyname='E2'" & " and t4.run(+)=mcr.run " End If If aprocess > 0 Then SQLStmt = SQLStmt & " and t5.keyname='A1' and abs(t5.numvalue-" & ra1 & ")<1" & " and t5.run(+)=mcr.run " SQLStmt = SQLStmt & " and t6.keyname='A2' and abs(t6.numvalue-" & ra2 & ")<1" & " and t6.run(+)=mcr.run " Else SQLStmt = SQLStmt & " and t5.keyname='A1'" & " and t5.run(+)=mcr.run " SQLStmt = SQLStmt & " and t6.keyname='A2'" & " and t6.run(+)=mcr.run " End If SQLStmt = SQLStmt & " order by mcr.run desc " ' response.write(SQLStmt & "
" ) Set RS = Connection.Execute(SQLStmt) %> Generator Run Finder

Generator Runs

Status on  <%=RSx("ddate")%> at <%=RSx("ttime")%> in <%=dbname%>

<% Do While Not RS.EoF If Not IsNull(RS("num_events")) Then num_events=CInt(RS("num_events")) Else num_events=0 End If ce1=Round(CDbl(RS("ce1")),2) ce2=Round(CDbl(RS("ce2")),2) ion1=GetIon(CInt(RS("ca1"))) ion2=GetIon(CInt(RS("ca2"))) cbmin=Round(CDbl(RS("cbmin")),4) cbmax=Round(CDbl(RS("cbmax")),4) If cbmin=cbmax Then bran="=" & CStr(cbmin) Else bran=CStr(cbmin) & "-" & CStr(cbmax) End If %> <% RS.MoveNext Loop %>
Run Run Date Program Name Events Energy Ions b Range Details
<%= RS("RUN") %> <%= RS("rdate") %> <%= RS("program_name") %> <%=num_events %> <%=ce1%>

x<%=ce2%>

<%=Ion1%>

x <%=Ion2%>

<%=bran%> ">Details
<% Connection.Close %>