%@ LANGUAGE="VBScript" %>
<%
time_start=Now()
request("text1")=rmin
request("text2")=rmax
request("text3")=style
'
' actions(0,i) action
' actions(1,i) description
'
Dim actions(1,20)
'create array for assigned icons
Dim color(4)
color(0)=" "' option1
color(1)="
" 'option2
color(2)="
" 'option3
'color(3)="img src="0c0-r0.jpg" width="26" height="10""" 'option4
'color(4)="img src="f00-r0.jpg" width="26" height="10""" 'option5
'
'color(0)="N/A" ' option1
'color(1)="OK" 'option2
'color(2)="MULT" 'option3
'color(3)="img src="0c0-r0.jpg" width="26" height="10""" 'option4
'color(4)="img src="f00-r0.jpg" width="26" height="10""" 'option5
'
' the database is programmed to send a fixed number of
' records for each run. We will select a set of runs of a given run type
' For each run type there is a well defined sequence of actions that need to be
' taken. To save network and computing bandwidth we will get a detailed list of
' actions and then assume that the individual run data comes in the same sequence.
'
' The actions will be stored in an array
'
'
If Request("run_type")<>"" Then
run_type=CStr(Request("run_type"))
Else
run_type="ALLBEAM"
End If
'
' Get first and last run number
'
If Request("rmin")<>"" Then
rmin=CInt(Request("rmin"))
Else
rmin=5000
End If
If Request("rmax")<>"" Then
rmax=CInt(Request("rmax"))
Else
rmax=5010
End If
'
' Open Database
'
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd
'
' This SQL statement gives an ordered list of actions related to run of type run_type
'
SQLStmt = " select ta.action,la.description from phoffline.track_actions ta,phoffline.log_actions la "
SQLStmt = SQLStmt & " where la.action=ta.action and la.action_type=1 and ta.run_type='" & run_type & "' "
SQLStmt = SQLStmt & " order by la.action_order "
' response.write(SQLStmt)
Set RS = Connection.Execute(SQLStmt)
nactions=0
Do While Not RS.EOF
actions(0,nactions)=CStr(RS("action"))
actions(1,nactions)=CStr(RS("description"))
nactions=nactions+1
RS.MoveNext
Loop
Set RS=nothing
'
' And this statement lists the run number and the number of times a given
' action was performed. 0 means that the action was never done.
'
SQLStmt = " select max(ta1.run) run,count(rl.action) naction from "
SQLStmt = SQLStmt & " (select rn.run,ru.run_type,ta.action from phoffline.log_entries le,phoffline.log_actions la, "
SQLStmt = SQLStmt & " phoffline.run_numbers rn, phoffline.runs ru, phoffline.track_actions ta "
SQLStmt = SQLStmt & " where ta.action=le.action and la.action=ta.action and rn.logid=le.logid and rn.run=ru.run"
SQLStmt = SQLStmt & " and ru.run_type='" & run_type & "' "
SQLStmt = SQLStmt & " and ta.run_type=ru.run_type and la.action_type=1 "
SQLStmt = SQLStmt & " and ru.run between " & CStr(rmin) & " and " & CStr(rmax) & ") rl, "
SQLStmt = SQLStmt & " (select r.run,l.action,l.action_order,r.run_type "
SQLStmt = SQLStmt & " from phoffline.track_actions t,phoffline.runs r,phoffline.log_actions l "
SQLStmt = SQLStmt & " where r.run_type='" & run_type & "' "
SQLStmt = SQLStmt & " and l.action=t.action and t.run_type=r.run_type and l.action_type=1 "
SQLStmt = SQLStmt & " and r.run between " & CStr(rmin) & " and " & CStr(rmax) & ") ta1 "
SQLStmt = SQLStmt & " where ta1.action=rl.action(+) and ta1.run=rl.run(+) "
SQLStmt = SQLStmt & " group by ta1.run,ta1.action "
SQLStmt = SQLStmt & " order by ta1.run desc,max(ta1.action_order) "
' response.write(SQLStmt)
Set RS = Connection.Execute(SQLStmt)
%>
| N/A | OK | MULT |
| Run | ") For i=0 To nactions-1 response.write("" & i+1 & " | ") Next response.write("" & run & " | ") For i=0 To nactions-1 naction=CInt(RS("naction")) ' ' Here we know the run number, action and how many times the given action was done ' Let's do primitive analysis/printouts ' If naction=0 Then Response.write("" & color(0) & " | ")' could add link to ' and bla would be related to the run number. 'bla="test_linked_page.asp?rmin="&run&(syntax may be wrong because run is a variable) ' "&rmax="&run+3&"&run_type="&run_type> 'bla here only links to test_linked_page.asp and the new page only displays 3 runs 'with the sequences Elseif naction=1 Then Response.write("" & color(1) & " | ") Else Response.write("" & color(2) & " | ") End If RS.MoveNext Next Loop Response.write("" & vbCrLf) %>