|
Subject:
|
response.write
|
|
Posted By:
|
netcrawler
|
Post Date:
|
9/29/2004 9:15:13 AM
|
 here is part of my code:
do until rs.EOF intTrainingDay=0 strTrainingTime = "" corpscount=corpscount+1
if strLang="e" then select case rs("elementid") case 1 Response.Write "<h4 class=sea>Sea<br>" case 2 Response.Write "<h4 class=army>Army<br>" case 3 Response.Write "<h4 class=air>Air<br>" end select end if
--------------------------------------------------------------
and this is the output, what i want is to have output only ONE "Sea" instead of having a Sea for each units. If you see below you will notice that there are 3 Units all within the Sea category but I want to have only ONE Sea to show up as the Category and have the Units follow bellow that. And hide the Sea for the other Units.
----------------------------------------------------------------
Sea 6 Victory 2055 DRUMMOND ST, MONTRÉAL, QC
Voice mail: 1-888-690-2236, followed by 471-0006 + # Email: 6marine@cadets.net
Unit trains Saturdays at 09H00
top of page
Sea 188 Trafalgar 6755 36E Avenue, Montréal, QC
Voice mail: 1-888-690-2236, followed by 471-0188 + # Email: 188marine@cadets.net
Unit trains Sundays at 09H00
top of page
Sea 233 École sec. Jean-Grou, 12725 boul Rodolphe-Forget, Montréal, QC
Voice mail: 1-888-690-2236, followed by 471-0233 + # Email: 233marine@cadets.net
Unit trains Mondays at 18:00
------------------------------------------------------
Can someone help me out here with this problem.
Thanks for your help.
|
|
Reply By:
|
pgtips
|
Reply Date:
|
9/29/2004 9:34:11 AM
|
Just keep track of what the last elementid was and only write out Sea etc when elementid changes, i.e. when rs("elementid") <> lastElementId.
|
|
Reply By:
|
netcrawler
|
Reply Date:
|
9/29/2004 9:41:42 AM
|
Thanks for the answer but could you write the full example string to guide me because i am kind of new in this and i am still learning..
Thanks.
|
|
Reply By:
|
happygv
|
Reply Date:
|
9/29/2004 9:55:45 AM
|
Dim lastElementId
do until rs.EOF
intTrainingDay=0
strTrainingTime = ""
corpscount=corpscount+1
If lastElementId <> rs("elementid") then
lastElementId = rs("elementid")
if strLang="e" then
select case rs("elementid")
case 1
Response.Write "<h4 class=sea>Sea<br>"
case 2
Response.Write "<h4 class=army>Army<br>"
case 3
Response.Write "<h4 class=air>Air<br>"
end select
End If
end ifHope that helps. Cheers!
_________________________ - Vijay G Strive for Perfection
|
|
Reply By:
|
netcrawler
|
Reply Date:
|
9/29/2004 10:13:22 AM
|
Thanks happygv you rock man i added the code to my script and Voila it worked like a charmed... again thanks.
|