pcdebb
April 25th, 2004, 01:10 PM
I seem to be very stumped on some asp code and I just don't know where to turn. I have a query that returns data and I want to show three of the fields. The fields/data (a general example):
area: this area
date: 4/25/04
counts: 3
area: that area
date: 4/25/04
counts: 6
area: another area
date: 4/25/04
counts: 4
area: this area
date: 4/26/04
counts: 6
area: another area
date: 4/26/04
counts: 4
etc......
now the way i would like to display this data:
date | this area | that area | another area (column headers)
4/25 | 3 | 6 | 4
4/26 | 6 | 0 | 4
notice that "that area" doesnt have any data for 4/26. if that is the case I want it to show a zero in the output. right now the data doesnt insert my zero and that second 4 will be there in its place, putting everything after it out of place.
in my asp code, after i spit out the column headers, i goto the next row, spit out the date, and I'm "trying" to correctly match the date with the column header, if the data is there, put that value, if there's no column header match for the date, then there's no data, enter the zero. I've run into alot of wierd problems (such as subscript out of range for the array i'm storing the info in, i got it to work), but the numbers come out, just not where they should go. the second row of data (after the column headers) the numbers seem to be right, but after that, they also seem to repeat.
I don't know what I"m doing wrong, but I've tried so many different things for the last four days and I'm getting myself more confused and frustrated as I try to get it to work correctly. Staying away from the code for a whole day didn't even help, as I'm still utterly confused as to the structure of this. I thank any brave soul in advance for any kind of guidance in the right direction
here's the snippet in question if it helps:
for i = 0 to 9
rdate(i) = cmdate(i)
thisDate = rdate(i)
response.write "<tr><td width='9%'><font size='1' face='Veranda, Arial, Helvetica, sans-serif'>"& thisdate & "</font></td>"
t = "select * from qgetCountsWeek where ((qdate = #"&thisDate&"#) AND (division = '"&getdivision&"'));"
rs2.open t, db, adOpenStatic
do while not rs2.eof
for t = 0 to aZoneCount
if aZone(t) = rs2("zone") then
countme = rs2("countme")
else
countme = 0
end if
response.Write "<td width='9%'><font size='1' face='Veranda, Arial, Helvetica, sans-serif'>" & countme & "</font></td>"
rs2.movenext
next
loop
response.write "</tr>"
rs2.close
next
area: this area
date: 4/25/04
counts: 3
area: that area
date: 4/25/04
counts: 6
area: another area
date: 4/25/04
counts: 4
area: this area
date: 4/26/04
counts: 6
area: another area
date: 4/26/04
counts: 4
etc......
now the way i would like to display this data:
date | this area | that area | another area (column headers)
4/25 | 3 | 6 | 4
4/26 | 6 | 0 | 4
notice that "that area" doesnt have any data for 4/26. if that is the case I want it to show a zero in the output. right now the data doesnt insert my zero and that second 4 will be there in its place, putting everything after it out of place.
in my asp code, after i spit out the column headers, i goto the next row, spit out the date, and I'm "trying" to correctly match the date with the column header, if the data is there, put that value, if there's no column header match for the date, then there's no data, enter the zero. I've run into alot of wierd problems (such as subscript out of range for the array i'm storing the info in, i got it to work), but the numbers come out, just not where they should go. the second row of data (after the column headers) the numbers seem to be right, but after that, they also seem to repeat.
I don't know what I"m doing wrong, but I've tried so many different things for the last four days and I'm getting myself more confused and frustrated as I try to get it to work correctly. Staying away from the code for a whole day didn't even help, as I'm still utterly confused as to the structure of this. I thank any brave soul in advance for any kind of guidance in the right direction
here's the snippet in question if it helps:
for i = 0 to 9
rdate(i) = cmdate(i)
thisDate = rdate(i)
response.write "<tr><td width='9%'><font size='1' face='Veranda, Arial, Helvetica, sans-serif'>"& thisdate & "</font></td>"
t = "select * from qgetCountsWeek where ((qdate = #"&thisDate&"#) AND (division = '"&getdivision&"'));"
rs2.open t, db, adOpenStatic
do while not rs2.eof
for t = 0 to aZoneCount
if aZone(t) = rs2("zone") then
countme = rs2("countme")
else
countme = 0
end if
response.Write "<td width='9%'><font size='1' face='Veranda, Arial, Helvetica, sans-serif'>" & countme & "</font></td>"
rs2.movenext
next
loop
response.write "</tr>"
rs2.close
next