Link to home
Start Free TrialLog in
Avatar of slegy
slegy

asked on

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??
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

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>

Avatar of slegy
slegy

ASKER

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.
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?
Avatar of slegy

ASKER

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)
ASKER CERTIFIED SOLUTION
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slegy

ASKER

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!