I recently saw a post that tackled an issue I was struggling with. It allowed me to get the results I wanted, but I need the expand on that.
Original Post
http://www.thescripts.com/forum/thread610974.html
I'm am working with ASP and I'm am filtering results from an Access DB.
I have the season, year and designer stored in the Database.
Example:
Designer | Season | Year
Paul Smith | AW | 07
Paul Smith | SS | 07
Paul Smith | AW | 06
Paul Smith | SS | 06
...and so on back to SS85
Paco Rabanne | AW | 07
Paco Rabanne | SS | 07
...and so on
My query looks for all Fashion Designers in Menswear Where the first letter of their name has been specified by the user. e.g. search = P
I would like to format thes returned result grouped by designer and to display the most recent 4 seasons out of a long list. e.g. AW07, SS07, AW06, SS06
Paul Smith
aw07 | ss07 | aw06 | ss06
Paco Rabanne
aw07 | ss07 | aw06 | ss06
I can group the results but I only want the dividers ' | ' to show between the seasons and not after the last result.
Currently my results return like this:
Paul Smith
aw07 | ss07 | aw06 | ss06 |
How can I edit my array/loop to sort this?
My Code
<%
Dim ar, CurrentDesigner, NextDesigner
If Not RS_designerLetter.EOF Then
ar = RS_designerLetter.GetRows
Dim titles
If isarray(ar) Then
CurrentDesigner = ar(0,0)
Response.Write "<p><strong>" & CurrentDesigner & "</strong><br>"
For i = 0 to ubound(ar,2)
NextDesigner = ar(0,i)
If CurrentDesigner < NextDesigner then
CurrentDesigner = NextDesigner
Response.Write "<br><strong>" & CurrentDesigner & "</strong><br>"
End if
Response.Write ar(1,i) & ar(2,i) & " | "
Next
Response.Write "<br><br>End of Records Found</p>"
Else
Response.Write "<p>No Records Were Retrieved</p>"
End if
End if
%>