473,799 Members | 3,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2288
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.c om...
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
tblDiseaseTitl e 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.Pu bID, tblLanguages.La nguageName,
tblTitle.TitleN ame, tblDisease.Dise aseName, TblRegion.Regio n
FROM TblRegion RIGHT JOIN ((tblLanguages RIGHT JOIN ((tblTitle LEFT
JOIN (tblDisease RIGHT JOIN tblDiseaseTitle ON tblDisease.Dise aseID =
tblDiseaseTitle .DiseaseID) ON tblTitle.titleI D =
tblDiseaseTitle .TitleID) RIGHT JOIN tblBrochures ON tblTitle.titleI D =
tblBrochures.Ti tle) ON tblLanguages.La nguageID =
tblBrochures.La nguageID) LEFT JOIN tblLanguageRegi on ON
tblLanguages.La nguageID = tblLanguageRegi on.LanguageID) ON
TblRegion.RegID = tblLanguageRegi on.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*****@TAKETH ISOUTkamath.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="VB SCRIPT" CODEPAGE="1252" %>
<!--#include file="../../Connections/IHEA_DNSLESS.as p" -->
<%
Dim rdsAllTitles
Dim rdsAllTitles_nu mRows

Set rdsAllTitles = Server.CreateOb ject("ADODB.Rec ordset")
rdsAllTitles.Ac tiveConnection = MM_IHEA_DNSLESS _STRING
rdsAllTitles.So urce = "SELECT * FROM qryAllTitles"
rdsAllTitles.Cu rsorType = 0
rdsAllTitles.Cu rsorLocation = 2
rdsAllTitles.Lo ckType = 1
rdsAllTitles.Op en()

rdsAllTitles_nu mRows = 0
%>
<%
Dim Repeat1__numRow s
Dim Repeat1__index

Repeat1__numRow s = -1
Repeat1__index = 0
rdsAllTitles_nu mRows = rdsAllTitles_nu mRows + Repeat1__numRow s
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitl ed 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="#CCCCC C">
<td><strong>Pub ID</strong></td>
<td><strong>Reg ion</strong></td>
<td><strong>Lan guage</strong></td>
<td><strong>Tit le</strong></td>
<td><strong>Sub ject</strong></td>
</tr>
<%
While ((Repeat1__numR ows <> 0) AND (NOT rdsAllTitles.EO F))
%>
<tr>
<td><%=(rdsAllT itles.Fields.It em("PubID").Val ue)%></td>
<td><%=(rdsAllT itles.Fields.It em("Region").Va lue)%></td>
<td><%=(rdsAllT itles.Fields.It em("LanguageNam e").Value)%> </td>
<td><%=(rdsAllT itles.Fields.It em("TitleName") .Value)%></td>
<td><%=(rdsAllT itles.Fields.It em("DiseaseName ").Value)%> </td>
</tr>
<%
Repeat1__index= Repeat1__index+ 1
Repeat1__numRow s=Repeat1__numR ows-1
rdsAllTitles.Mo veNext()
Wend
%>

</table>
</body>
</html>
<%
rdsAllTitles.Cl ose()
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******** *********@msnew s.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
tblDiseaseTitl e 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
3067
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 single file, but then be able to take this one single file and recreate the files I put into it. Im really at a loss as to how I go about recovering the files?
5
2283
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 nothing is displayed in this table. I have used the code that DMX generates using the server behaviour 'Show region if recordset is empty', but no success. Appreciate someone pointing out where I'm going wrong here.
2
5139
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 current status. In Access 2000, you can only write the code on each control in a general way and the code will apply on to the current record. For instance, if you have 5 customers in display, each one of them has difference balance, if you like to...
4
2641
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
6605
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 tables/files to reduce download time and bandwidth usage on my web server. That way, the user can select a particular page to download instead of downloading a page with all of the records. I would like to set a limit of only 500 records per file.
12
3012
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 getting any records inserted. For troubleshooting, I cut the form down to 1 textbox and when submitted it populated 5 rows of the same data. So I know I'm connected, but not getting the LOOP and NEXT correct? How do I set this up so many records can be...
5
3004
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 a certain date (in this case January 30th) the database will return 2 rows for an order as you can see below. Order ID: Line: Due Date: Qty: Ship Qty: Part #: Shipped: 141285 1 1/30/2006 31 10 S15F-55
52
6360
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 variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the distinct groups
7
15664
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.