473,382 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to show multiple records in the same line

On this page, you'll see that some PubID's are repeated several times:
http://www.ihea.info/pages/website/test1.asp

That's because some records have more than one attribute. For example,
Title with pubID 10 is about both Cervical Cancer and Endometrial
Cancer, so pubID 10 appears twice.

How do I make ASP show me only one instance of record 10 and then
simply concantenate Cervical Cancer and Endometrial Cancer?

So it would look like this:

10 North Africa Swahili Cervical Cancer: Stay
Healthy! Cervical Cancer & Endometrial Cancer

Here's my relationship:
http://www.ihea.info/pages/website/testimages/rel.gif
tblDiseaseTitle serves as an intermediary to enable many-to-many
relationship between tblDisease (where the multiple subjects come
from) and tblTitle.

If it is easier to correct this in database, I use Access 2002.

thanks in advance,

crispy

Jul 19 '05 #1
5 2271
First, you have to group the records by the PubID (easy, using Sort)

Second, use a loop to figure out "breaks" in the pubID

' Initialize previous ID to empty
prevPubID = vbNullstring

' Loop through the entire recordset
Do While Not Rs.EOF
' Set the current pub ID
curPubID = Rs("PubID")

' If the current ID not equal to previous one, create a new paragraph
If curPubID <> prevPubID Then
Response.Write("<P>" & curPubID)
End If

' Write out the attributes
Response.Write(Rs("Title"))

Rs.MoveNext

' Set previous ID to current one
prevPubID = curPubID
Loop

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
<crispy> wrote in message news:95********************************@4ax.com...
On this page, you'll see that some PubID's are repeated several times:
http://www.ihea.info/pages/website/test1.asp

That's because some records have more than one attribute. For example,
Title with pubID 10 is about both Cervical Cancer and Endometrial
Cancer, so pubID 10 appears twice.

How do I make ASP show me only one instance of record 10 and then
simply concantenate Cervical Cancer and Endometrial Cancer?

So it would look like this:

10 North Africa Swahili Cervical Cancer: Stay
Healthy! Cervical Cancer & Endometrial Cancer

Here's my relationship:
http://www.ihea.info/pages/website/testimages/rel.gif
tblDiseaseTitle serves as an intermediary to enable many-to-many
relationship between tblDisease (where the multiple subjects come
from) and tblTitle.

If it is easier to correct this in database, I use Access 2002.

thanks in advance,

crispy

Jul 19 '05 #2
On Mon, 15 Mar 2004 15:44:02 -0500, crispy <> wrote:
On this page, you'll see that some PubID's are repeated several times:
http://www.ihea.info/pages/website/test1.asp

That's because some records have more than one attribute. For example,
Title with pubID 10 is about both Cervical Cancer and Endometrial
Cancer, so pubID 10 appears twice.

How do I make ASP show me only one instance of record 10 and then
simply concantenate Cervical Cancer and Endometrial Cancer?

So it would look like this:

10 North Africa Swahili Cervical Cancer: Stay
Healthy! Cervical Cancer & Endometrial Cancer

Here's my relationship:
http://www.ihea.info/pages/website/testimages/rel.gif
tblDiseaseTitle serves as an intermediary to enable many-to-many
relationship between tblDisease (where the multiple subjects come
from) and tblTitle.

If it is easier to correct this in database, I use Access 2002.


You don't show any structure or database schema so I can't say for
certain you'd want to change your design for this, though simply
normalizing the database might solve this. Otherwise, a SELECT
DISTINCT in your query should get you a single instance of each. Post
the actual query if you're still having troubles.

Jeff
Jul 19 '05 #3
You don't show any structure or database schema so I can't say for
certain you'd want to change your design for this, though simply
normalizing the database might solve this. Otherwise, a SELECT
DISTINCT in your query should get you a single instance of each. Post
the actual query if you're still having troubles.

Jeff

Thanks Jeff for your response.

Here's the SQL of the query:

SELECT tblBrochures.PubID, tblLanguages.LanguageName,
tblTitle.TitleName, tblDisease.DiseaseName, TblRegion.Region
FROM TblRegion RIGHT JOIN ((tblLanguages RIGHT JOIN ((tblTitle LEFT
JOIN (tblDisease RIGHT JOIN tblDiseaseTitle ON tblDisease.DiseaseID =
tblDiseaseTitle.DiseaseID) ON tblTitle.titleID =
tblDiseaseTitle.TitleID) RIGHT JOIN tblBrochures ON tblTitle.titleID =
tblBrochures.Title) ON tblLanguages.LanguageID =
tblBrochures.LanguageID) LEFT JOIN tblLanguageRegion ON
tblLanguages.LanguageID = tblLanguageRegion.LanguageID) ON
TblRegion.RegID = tblLanguageRegion.RegionID;

I changed the "Select" to "Select Distinct", but nothing changed.

By "database schema" do you mean the output created by Analyze /
Documenter ? I did the query and posted it at this address:
http://www.ihea.info/pages/website/q...ptObjects.html

If you see any room for normalizing, please point it out. I thought I
did a lot of reading on normalizing and can't figure out how it could
be normalized further.

Thanks for your help. crispy
Jul 19 '05 #4
On Mon, 15 Mar 2004 15:51:05 -0600, "Manohar Kamath [MVP]"
<mk*****@TAKETHISOUTkamath.com> wrote:
' Initialize previous ID to empty
prevPubID = vbNullstring

' Loop through the entire recordset
Do While Not Rs.EOF
' Set the current pub ID
curPubID = Rs("PubID")

' If the current ID not equal to previous one, create a new paragraph
If curPubID <> prevPubID Then
Response.Write("<P>" & curPubID)
End If

' Write out the attributes
Response.Write(Rs("Title"))

Rs.MoveNext

' Set previous ID to current one
prevPubID = curPubID
Loop


Manohar, thanks for your reply. Exactly, where in the page should put
in your code? Should I get rid of the repeat regions? I could use any
amount of help since I'm pretty confused about this right now. I'm
trying to understand your code using a couple of books I have here.
Thanks again. crispy.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/IHEA_DNSLESS.asp" -->
<%
Dim rdsAllTitles
Dim rdsAllTitles_numRows

Set rdsAllTitles = Server.CreateObject("ADODB.Recordset")
rdsAllTitles.ActiveConnection = MM_IHEA_DNSLESS_STRING
rdsAllTitles.Source = "SELECT * FROM qryAllTitles"
rdsAllTitles.CursorType = 0
rdsAllTitles.CursorLocation = 2
rdsAllTitles.LockType = 1
rdsAllTitles.Open()

rdsAllTitles_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rdsAllTitles_numRows = rdsAllTitles_numRows + Repeat1__numRows
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body>
<table width="100%" border="1" cellpadding="5">
<tr bgcolor="#CCCCCC">
<td><strong>PubID</strong></td>
<td><strong>Region</strong></td>
<td><strong>Language</strong></td>
<td><strong>Title</strong></td>
<td><strong>Subject</strong></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rdsAllTitles.EOF))
%>
<tr>
<td><%=(rdsAllTitles.Fields.Item("PubID").Value)%> </td>
<td><%=(rdsAllTitles.Fields.Item("Region").Value)% ></td>
<td><%=(rdsAllTitles.Fields.Item("LanguageName").V alue)%></td>
<td><%=(rdsAllTitles.Fields.Item("TitleName").Valu e)%></td>
<td><%=(rdsAllTitles.Fields.Item("DiseaseName").Va lue)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rdsAllTitles.MoveNext()
Wend
%>

</table>
</body>
</html>
<%
rdsAllTitles.Close()
Set rdsAllTitles = Nothing
%>

Jul 19 '05 #5
Could using "GROUP BY" in the SQL statement do this to group multiple
records with the same data in the paticular field into thier own "sections"
on the page?

Kind of like:...

SELECT * FROM Table GROUP BY CertainField

Then display something like this:

CertainField
Row of data here
Row of data here
Row of data here
CertainField
Row of data here
Row of data here
Row of data here

I know I wasn't the one who asked, but I like to "get a grip" on it too.
:-)
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"Jeff Cochran" <jc*************@naplesgov.com> wrote in message
news:40*****************@msnews.microsoft.com...
On Mon, 15 Mar 2004 15:44:02 -0500, crispy <> wrote:
On this page, you'll see that some PubID's are repeated several times:
http://www.ihea.info/pages/website/test1.asp

That's because some records have more than one attribute. For example,
Title with pubID 10 is about both Cervical Cancer and Endometrial
Cancer, so pubID 10 appears twice.

How do I make ASP show me only one instance of record 10 and then
simply concantenate Cervical Cancer and Endometrial Cancer?

So it would look like this:

10 North Africa Swahili Cervical Cancer: Stay
Healthy! Cervical Cancer & Endometrial Cancer

Here's my relationship:
http://www.ihea.info/pages/website/testimages/rel.gif
tblDiseaseTitle serves as an intermediary to enable many-to-many
relationship between tblDisease (where the multiple subjects come
from) and tblTitle.

If it is easier to correct this in database, I use Access 2002.


You don't show any structure or database schema so I can't say for
certain you'd want to change your design for this, though simply
normalizing the database might solve this. Otherwise, a SELECT
DISTINCT in your query should get you a single instance of each. Post
the actual query if you're still having troubles.

Jeff

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: googlinggoogler | last post by:
Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one...
5
by: David Ehmer | last post by:
The code below is 2 rows in a table, the top row contains a message to be shown if the recordset returns no matches. The 2nd row will display any matches. Problem is that if no matches are found...
2
by: JK | last post by:
Hi All, I am working a form which is tabular layout (continuous form) which will display multiple records at a time. Each line of record needs to be reflected on the color code to show their...
4
by: news.online.no | last post by:
In a query, I need too be able to show if a parent record has a child record. Using the query in a combo box too select record in a form. Thanks :)
1
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML...
12
by: shank | last post by:
I'm trying to use online samples for submitting multiple records from ASP into a stored procedure. Failing! Through the below form, a user could be submitting many records at a time. I'm not...
5
by: jhutchings | last post by:
Hello everyone, I have a database where I collect shipment data from various tables. However, I have a problem. Whenever I want to see shipping data for orders that were set to ship on or before...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.