[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

dynamic rowspans

Posted on 2000-03-22
5
Medium Priority
?
993 Views
Last Modified: 2010-05-18
hi...
how can i generate dynamic rowspan's...
i mean that situation:
im retrieving records from db:

date         name   item
----        ----   -----
1/1/00      david  table
1/1/00      david  chair
1/1/00      david  car
1/1/00      bill   book

but,i want to display on
the screen this:

date      name      item
----      -----      ----
1/1/00      david      table
            chair
            car
      bill      book
0
Comment
Question by:eladr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Author Comment

by:eladr
ID: 2644648
i mean this:
date      name      item
----      -----      ----
1/1/00      david      table
                chair
                car
      bill      book
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2645007
well, if the record you are reading is empty then just do a <td></td>
Oh...you mean that you want a string OVER multiple td's???

yu do that using the colspan like:

<table>
  <tr>
    <td>uno</td><td>duo</td>
  </tr>
  <tr>
    <td colspan=2><center>trio</center></td>
  </tr>
</table>

just suit yourself with the information you retrieve out of the database....
0
 
LVL 1

Author Comment

by:eladr
ID: 2645097
you didnt understand my quetion.
see it again...
i dont want the date and the name "david" in this case will appear more than one.

elad
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2646151
YOu would just pass the SQL string the parameters required to match;

SQL = "SELECT Date, Name, Item FROM TABLE WHERE Name = '" & Request.Form("Name") &"'"

Then it's simply a matter of looping through the data to write the Items;

<%
If Not rs.eof Then
%>
<tr bgcolor="#cbcb96" >
<td align="middle"><% = rs.Fields("Name") %></td>
<td  align="middle"><%= rs.Fields("Date") %>
</td>
</tr>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>
<tr valign="top">
<td  valign="top" width=60>
<%=Server.HTMLEncode(rs.Fields("Name").Value)%></td>
</tr>
<%
rs.MoveNext
loop
%>


You will have to play with the tables and rowspans and such...
0
 

Accepted Solution

by:
doantu01 earned 15 total points
ID: 2646267
ELADR ,I think no need to do such your very dificult way.
Instead, you have many choice
Like CJ_S, you can place a blank cell if you don't want display same data as previous record.I think it is the simplest. Or you can use nested table.
In the following sample I use nested table:
=======================
there are 3 fields:sdate,sname,sitem in my RowSpan table

<%
dim dbcnn
dim rcs
dim prename,predate
set dbcnn=Server.CreateObject("ADODB.Connection")
dbcnn.Open "RowSpan","sa",""
set rcs=dbcnn.Execute("Select * from RowSpan order by sdate,sname")
if (not(rcs.eof and rcs.bof)) then
%>
<table border=1 width=100%>
<tr><td>Date</td><td width=25%>Name</td><td width=25%>Item</td></tr>
<%
      do while not rcs.eof
      predate=rcs.fields("sdate")
%>
      <tr>
      <td><%=predate%></td>
      <td colspan=2>
      <table border=0 width=100%>
      <%
      do while (predate=rcs.fields("sdate"))
      prename=rcs.fields("sname")
      %>
      <tr>
      <td width=50%><%=prename%></td>
      <td>
      <table border=0>
            <%
                  do while (predate=rcs.fields("sdate")) and (prename=rcs.fields("sname"))
                  %>
                  <tr><td><%=rcs.fields("sitem")%></td></tr>
                  <%
                  rcs.movenext                  
                  if rcs.eof then
                        exit do
                  end if
                  loop
            %>
      </table>
      </td>
      </tr>
      <%
      if rcs.eof then
            exit do
      end if
      loop
      %>
      </table>
      </td>
      </tr>
<%
      loop
%>
</table>
<%
else
      Response.Write("Record is empty")
end if
rcs.close
dbcnn.Close()
set rcs=nothing
set dbcnn=nothing
%>
=======================
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question