Modify Table Display II

I previously submitted this question, and we thought the solution was identified:
I have a web page that displays fleet information from a database by district. Each district has a variable number of fleets, and each fleet has a variable number of contact lines:
  <div id="fleetInfo">
          <table>
            <% While ((Repeat2__numRows <> 0) AND (NOT rsfleetOfficers.EOF)) %>
              <tr>
                <td width="450"><%=(rsfleetOfficers.Fields.Item("fleet").Value)%></td>
                <td width="220"><%=(rsfleetOfficers.Fields.Item("name").Value)%></td>
            </tr>
              <%
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  rsfleetOfficers.MoveNext()
Wend
%>
          </table>
  </div>
Each record also contains a fleet number. I would like to create extra spacing between each fleet grouping, and/or, preferably, draw a horizontal line.

I took the provided solution and made a couple of changes:
    <div id="fleetInfo">
      <table>
        <% iFleet = rsfleetInfo.Fields.Item("fleetNo").Value %>
        <hr width=95% />
        <% While ((Repeat2__numRows <> 0) AND (NOT rsfleetInfo.EOF))
          If rsfleetInfo.Fields.Item("fleetNo").Value <> iFleet then
                iFleet = rsfleetInfo.Fields.Item("fleetNo").Value%>
                <hr width=95% />
         <% End If%>
          <tr>
            <td width=450><%=(rsfleetInfo.Fields.Item("fleet").Value)%></td>
            <td width=220><%=(rsfleetInfo.Fields.Item("name").Value)%></td>
          </tr>
          <%
        Repeat2__index=Repeat2__index+1
        Repeat2__numRows=Repeat2__numRows-1
        rsfleetInfo.MoveNext()
      Wend
      %>
      </table>
    </div>
There are no processing errors, but no matter where I put the "If" code, all the horizontal lines display first, followed by the fleet information

Now this is really weird. I just copied from the web page to show what is happening, and the pasted the information here. The horizontal lines were exactly where they are supposed to be. I also copied and pasted to Notepad and got the same results??

--------------------------------------------------------------------------------
 Fleet 3 - Bay Head Yacht Club - Barnagat Bay  
 Robert O'Brien, Fleet Captain
 David M Olney, Fleet Secretary


--------------------------------------------------------------------------------

 Fleet 26 - Little Egg Harbor - Little Egg Harbor Bay  
 Jody Robinson, Fleet Captain
 Franz K Schneider, Fleet Secretary


--------------------------------------------------------------------------------

 Fleet 34 - Metedeconk River Yacht Club - Metedeconk River  
 Mitchell Hnatt, Fleet Captain
 James G Carson, Fleet Secretary

Any ideas??
slegyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Beverley PortlockCommented:
It seems to me that, stripping out some of the server side code, the HTML you are generating is like so

<table>
        <hr width=95% />
        <hr width=95% />
          <tr>
            <td width=450><%=(rsfleetInfo.Fields.Item("fleet").Value)%></td>
            <td width=220><%=(rsfleetInfo.Fields.Item("name").Value)%></td>
          </tr>
      </table>


Now - that just does not make sense. Those <Hr> tags should not be there, they should be more like


<table>
         <tr>
            <td colspan='2'>
                 <hr width=95% />
            </td>
         </tr>
          <tr>
            <td width=450><%=(rsfleetInfo.Fields.Item("fleet").Value)%></td>
            <td width=220><%=(rsfleetInfo.Fields.Item("name").Value)%></td>
          </tr>
      </table>




So it seems to me that your original code should look like this


    <div id="fleetInfo">
      <table>
        <tr>
        <td colspan='2'>
        <% iFleet = rsfleetInfo.Fields.Item("fleetNo").Value %>
        <hr width=95% />
        <% While ((Repeat2__numRows <> 0) AND (NOT rsfleetInfo.EOF))
          If rsfleetInfo.Fields.Item("fleetNo").Value <> iFleet then
                iFleet = rsfleetInfo.Fields.Item("fleetNo").Value%>
         <% End If%>
         </td>
         </tr>
          <tr>
            <td width=450><%=(rsfleetInfo.Fields.Item("fleet").Value)%></td>
            <td width=220><%=(rsfleetInfo.Fields.Item("name").Value)%></td>
          </tr>
          <%
        Repeat2__index=Repeat2__index+1
        Repeat2__numRows=Repeat2__numRows-1
        rsfleetInfo.MoveNext()
      Wend
      %>
      </table>
    </div>

0
slegyAuthor Commented:
The goal is to put a horizontal rule first, then put a horizontal rule before each change of fleet number. I'm trying to put a dividing line between each fleet grouping.
0
Beverley PortlockCommented:
slegy said "I'm trying to put a dividing line between each fleet grouping."

Fair enough - but the HR's must be enclosed in <td> tags within a table. The code you posted inserts the HR's "between" rows and that will not help. Also, I think you have a misunderstanding somewhere or you haven't explained it all - your examples show 3 lines of output per section but you only have two output statements that I can see.

Can you explain the format of your incoming data? What are you expecting it to look like as it comes in from the table/data stream?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

slegyAuthor Commented:
bportlock: are you saying that the only way I can get a dividing horizontal rule between each fleet grouping is to create a database field for it? The solution I listed was the one provided when I first posted this question. It appeared reasonable and I accepted it. Unfortunately, I did not fully test it before doing so. So I just want clarity. Are you saying that it is NOT possible to draw the horizontal line between fleet groupings by using the <hr> and that it has to come from the database?

TWO database fields are being displayed:
1. A fleet number, description, location (combined in one field)
2. The name and title of a fleet officer (combined in one field)
0
Beverley PortlockCommented:
slegy said"are you saying that the only way I can get a dividing horizontal rule between each fleet grouping is to create a database field for it?"

No I am not saying that. I am saying that if you want the HR in the table then it must be in a table cell. Your other option is to have individual tables for each grouping with HR between then. From looking at your code it seems that you are inserting the HR tag *between* the table's TR tags.


Have you tried the code below? What did it produce? I have put a "border" attribute on the HTML so that it is easier to see the table and where things are going and moved the spacing around to clarify the position of the HTML elements in relation to each other


    <div id="fleetInfo">
      <table border='1'>
      
        <tr>
           <td colspan='2'>
             <hr width=95% />
           </td>
        </tr>
        
        <% iFleet = rsfleetInfo.Fields.Item("fleetNo").Value %>
        <% While ((Repeat2__numRows <> 0) AND (NOT rsfleetInfo.EOF))
              If rsfleetInfo.Fields.Item("fleetNo").Value <> iFleet then
                 iFleet = rsfleetInfo.Fields.Item("fleetNo").Value%>
        <%    End If%>
        
        <tr>
           <td width=450><%=(rsfleetInfo.Fields.Item("fleet").Value)%></td>
           <td width=220><%=(rsfleetInfo.Fields.Item("name").Value)%></td>
        </tr>
        
        <%
              Repeat2__index=Repeat2__index+1
              Repeat2__numRows=Repeat2__numRows-1
              rsfleetInfo.MoveNext()
           Wend
        %>
        
      </table>
    </div>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slegyAuthor Commented:
Bless you - that is exactly what I was looking for. the "hr" code needed to be moved now with the "If" statment, and now it works perfectly. Thank you - it's good to get a better insight into how these things work!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.