• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

Showing Item Once in Do WHile Loop

In the following how can I make this loop only display the piarea once.

Meaning piarea is the title and instead of having it display for each title I want the piarea to display once then have the title items underneath it. Example right now if the piarea is listed for
Square twice I see Square listed then the title - then Square agaian then the title. I only want square displayed once then the two titles underneath it:

Do While Not recAll.EOF
srArea = recAll("piarea").Value
strAbstract = recAll("pititle"))
                              
Response.Write "<br>" & strArea
Response.Write "<br>" & strAbstract & "<br><br>"
                                    
                                                            
recAll.moveNext
Loop

0
kpu8
Asked:
kpu8
1 Solution
 
Saqib KhanSenior DeveloperCommented:
Dim Once
Once = 0

Do While Not recAll.EOF

 if Once = 0 Then

   srArea = recAll("piarea").Value

 End if
strAbstract = recAll("pititle"))

Once = Once + 1

Response.Write "<br>" & strArea
Response.Write "<br>" & strAbstract & "<br><br>"
                             
                                                 
recAll.moveNext
Loop
0
 
kolluCommented:
This can be used to display once for any repeated columns
dim PrevArea = ""
dim CurrArea = ""
Do While Not recAll.EOF
srArea = recAll("piarea").Value
strAbstract = recAll("pititle"))
CurrArea =  srArea
if(CurrArea <>  PrevArea) then
  Response.Write "<br>" & strArea
else
 Response.Write "<br>&nbsp;
end if
Response.Write "<br>" & strAbstract & "<br><br>"                      
PrevArea = CurrArea
recAll.moveNext
Loop
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now