%
dim ans
dim a, b, c, d, e
a=0
b=0
c=0
d=0
e=0
Set FS=Server.CreateObject("Scripting.FileSystemObject")
Set RS=FS.OpenTextFile(Server.MapPath("answers.txt"), 1, False)
ans=RS.ReadAll
RS.Close
Set RS=Nothing
Set FS=Nothing
eachitem = split(ans,"|")
%>
Poll Results
Poll Responses
<%
if len(ans)>10 then
for i = 0 to ubound(eachitem) -1
eachelement = split(eachitem(i),":")
redim preserve poll(i+1)
redim preserve people(i+1)
redim preserve answers(i+1)
redim preserve q(i+1)
redim preserve a1(i+1)
redim preserve a2(i+1)
redim preserve a3(i+1)
redim preserve a4(i+1)
redim preserve a5(i+1)
redim preserve timeday(i+1)
poll(i) = eachelement(1)
answers(i) = eachelement(2)
people(i) = eachelement(3)
q(i) = eachelement(4)
a1(i) = eachelement(5)
a2(i) = eachelement(6)
a3(i) = eachelement(7)
a4(i) = eachelement(8)
a5(i) = eachelement(9)
timeday(i) = eachelement(10)
next
for n = 0 to ubound(poll) - 1
if oldpoll <> poll(n) then
response.write("---- Poll Serial Number " & poll(n) &" ---- |
|
")
response.write("Question: " & q(n) & " | A1: " & a1(n) & " | A2: " & a2(n) & " | A3: " & a3(n) & " | A4: " & a4(n) & " | A5:" & a5(n) & " |
")
response.write("Name | Response | Date | ")
for m = 0 to ubound(poll)
if poll(m) = poll(n) then
response.write(" " & people(m) & " | " & answers(m) & " | " & timeday(m) & " | ")
'calculate the totals of all answers for this poll number
if answers(m) = "A1" then a = a + 1
if answers(m) = "A2" then b = b + 1
if answers(m) = "A3" then c = c + 1
if answers(m) = "A4" then d = d + 1
if answers(m) = "A5" then e = e + 1
end if
next
response.write("
Totals | - | A1 | " & a & " | A2 | " & b & " | A3 | " & c & " | A4 | " & d & " | A5 | " & e & " |
|
")
a=0
b=0
c=0
d=0
e=0
oldpoll = poll(n)
end if
next
end if
%>