PDA

View Full Version : Categorizing Results ?


zadjali2000
01-15-2004, 03:46 PM
Hi,

I have a problem when displying data from multiple years, because all the years which are going to be displyed in Rows are written "year after another" which makes it hard to be read.

ex

Data | Year
1 | 1990
2 | 1991
3 | 1992
4 | 1993
5 | 1994
6 | 1995
7 | 1996
8 | 1997

What i would like to do is to Disply the Table Header (Data, Year) whenever a new year data will be selected within the loop.

Any ideas or Help will be very appreciated


Thanx in Advance

glenngv
01-20-2004, 07:00 AM
Are the data taken from the database?
The result should be ordered by Year so that records with same years are grouped.


dim prevYear, currYear
while not rs.eof
currYear = rs("year")
if prevYear<>currYear or prevYear="" then
if prevYear<>"" then response.write "</table>" & VbCrLf
response.write "<table><tr><td>Table</td><td>Year</td></tr>" & VbCrLf
end if
response.write "<tr><td>" & rs("data") & "</td><td>" & rs("year") & "</td></tr>" & VbCrLf
prevYear=currYear
rs.movenext
wend


Note: not tested but should give you an idea