Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display one page per record w/blank

Status
Not open for further replies.

Corneliu

Technical User
Sep 16, 2002
141
US
I have an inventory of software system that I need to keep track of where each CD is, what page, etc.

I am trying to display one page at the time (4 CDs per page), but have option to goto next page. I display the data by book #.
If the page # only has 3 CDs, I want to diplay 3 CDs only and for the forth one, just a blank space(background picture). Right now it displays 3 CDs from the one page requested, but the forth one is from the next page.
How can I do this without limiting the data gathered from the SQL Database?

Request all the data from one book. Than display 4 records at the time across in a table, and if that one page has only 3 records, than display the forth one blank table. I hope this explains it right, I hope.
Each software title has a startpage. I tried SQL statement where StartPage = '" & WhichPage & "', WhichPage being a Request.QueryString, but if I do this, than the navigation system only comes up with 1 total pages and cant move to the next page.

This is what I have:

Set RS = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection = MM_ReportsRemote_STRING
RS.Source = "SELECT SoftwareInventory.SoftwareTitle, SoftwareInventory.StartPage, Software.SoftwareName, Software.SoftwareVersion FROM Software INNER JOIN SoftwareInventory ON SoftwareInventory.SoftwareTitle = Software.SoftwareID WHERE SoftwareInventory.BookID = '" & BookNumber & "' ORDER BY SoftwareInventory.StartPage ASC"
RS.CursorType = 2
RS.CursorLocation = 3
RS.LockType = 1
RS.Open()
If NOT RS.EOF then
RS.pagesize=mypagesize
RS.AbsolutePage = mypage
maxpages=cInt(RS.pagecount)
maxrecs=cInt(RS.pagesize)

The display:
<% dim i %>
<table width=&quot;560&quot; height=&quot;280&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; bgcolor=&quot;6B8EB5&quot; class=&quot;menu&quot;>
<!--DWLayoutTable-->

<% Do while not RS.EOF and RowCount < RS.PageSize %>
<tr>
<% for i=1 to 2 %>
<td width=&quot;280&quot; height=&quot;280&quot; background=&quot;../../../images/CDbg.jpg&quot; bgcolor=&quot;#FFFFFF&quot;><div align=&quot;center&quot;><span class=&quot;linkbig&quot;><font color=&quot;#000000&quot;><em><%=RS(&quot;SoftwareName&quot;)%></em></font></span><font color=&quot;#000000&quot;><em><BR>
(<%=RS(&quot;Softwareversion&quot;)%>)<% WhatPage = RS(&quot;StartPage&quot;) %>
</em></font></div></td>
<% RS.movenext
RowCount = RowCount + 1
%>
<% if RS.EOF then exit for%>

<%next%>
</tr>
</tr>
<%loop%>
<tr><td colspan=&quot;2&quot; valign=&quot;bottom&quot; bgcolor=&quot;f0f0f0&quot;><div align=&quot;right&quot; class=&quot;Graph&quot;>Page#: <%Response.Write (WhatPage) %></div></td>

</table>

Currently:

Book #1.

Page 1 Ms Office Visio 5.0
Dreamweaver IBM PCOMM
But IBMPCOMM software belongs to startpage 2.

What I would like
Book #1.
Page 1 Ms Office Visio 5.0
Dreamweaver nothing

Page 2 IBM PCOMM Nothing
Nothing Nothing
 
You could create a temporary variable right before your loop to hold the page # from the first reciord your going to be displaying, then inside your loop do an if statement to check if the stored page number is equal to the one coming from the recordsaet for each record, if it is do what you have above, else print a blank row.

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Just thought of a problem with this, you have two types of paging and your going to lose records. You have your page numbers from the database and then you have your recordset paging your doing in your code. Pretend your db entries look like this for the page number column:
1
1
1
2
2
2
2
Your going to lose that first 2. The recordset is setting up paging for you by grouping the records into groups of 4. When you ask for it to qeueu up the first page it is going to give you this:
-
1
1
1
2
-
2
2
2
Then if you ignore that two, when you later request page 2 from your recordset paging it will give you this:
1
1
1
2
-
2
2
2
-
Ie, the next set of 4 records. See how your losing the first entry for page 2?

You mayneed to come up with your own paging scheme to handle this, as your trying to display based off the page numbers in the db, and those are more important than definately having 4 records per page.

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Tarwn, you always have the answer. Well, I went around what you said above.
I build my own navigation system, kind of, and basically I query the database with page numbers. Each book has a certain amount of pages, so I put that into the navigation system. When I press that page number, the screen displays the page with 4 CDs along with software name, etc.
It all works well, tested and great, BUT, this is the problem when I try to do that. Maybe is the way I designed the table, or the layout or something I am doing wrong, or not coding it right.
When I enter the data into the database, the table has a StartPage and an EndPage. If the Software goes beyond 4 CDs (microsoft software usually), than that record will be StartPage 1 EndPage 10 (Ex: MS BackOffice 2000, 10 CDs).
If I query the database and ask WHERE StartPage = '&quot; & NavigationSystemPage & &quot;'&quot; than it will give me the first page only with the first 4 CDs. When I press the second page, nothing will show up because StartPage does not equal 1 no more.
How can I query the database to allow me to look at the StartPage and the EndPage, but only show the NavigationSystemPage Page #?
Basically if the page is between (2 of 10) than display that on the second page.

I hope I explained it properly.

Thank You Again for your HELP...
Much Appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top