Forums

This topic is locked

Paging problem

Posted 15 Apr 2008 18:54:41
1
has voted
15 Apr 2008 18:54:41 debra owens posted:
DW8 SQL2000

I have two recordset1 and 2

Set up the paging Next and Previous for Recordset1 and same for Recordset2

Move to Previous and Next records points to Recordset1 for both?
If I fix one the other points to it.

Is there away to have two different Previous/Next paging buttons on the same page?

Replies

Replied 17 Apr 2008 05:31:47
17 Apr 2008 05:31:47 Javier Castro replied:
It seems that your paging may be pointing to the same recordset. Show your code

Javier
"I'm a slow learner and I forget fast" grandpa
DW | FW | ASP | HTML | CSS
Replied 17 Apr 2008 14:12:42
17 Apr 2008 14:12:42 debra owens replied:
It's a lot of code.
The <A HREF="<%=MM_movePrev%>"> and <A HREF="<%=MM_moveNext%>"> seems like I can only apply once per page.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/datawarehouse.asp" -->
<!--#include virtual="Members/ForceSSL.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="LogOut.asp"
MM_grantAccess=false
If Session("UserId" <> "" Then
If (true Or CStr(Session("MM_UserAuthorization")="" Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization")>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?" >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL"
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim qMemClm__sMbrId
qMemClm__sMbrId = "0"
If (Session("MbrId" <> "" Then
qMemClm__sMbrId = Session("MbrId"
End If
%>
<%
Dim qMemClm
Dim qMemClm_cmd
Dim qMemClm_numRows

Set qMemClm_cmd = Server.CreateObject ("ADODB.Command"
qMemClm_cmd.ActiveConnection = MM_datawarehouse_STRING
qMemClm_cmd.CommandText = "SELECT MbrId, MbrName, SvcDt, ClaimId, ProvName, LocDesc, Status, ClaimSeqNo,ClmType FROM dbo.dw_v_WebMemClmDet with (nolock,INDEX(ak_MV_MbrId)) WHERE MbrId = ? and ClaimSeqNo=1 and Clmtype NOT IN ('DT','VT','RX') ORDER BY SvcDt desc"
qMemClm_cmd.Prepared = true
qMemClm_cmd.Parameters.Append qMemClm_cmd.CreateParameter("param1", 200, 1, 255, qMemClm__sMbrId) ' adVarChar

Set qMemClm = qMemClm_cmd.Execute
qMemClm_numRows = 0
%>
<%
Dim qDental__sMbrid
qDental__sMbrid = "1"
If (Session("MbrId" <> "" Then
qDental__sMbrid = Session("MbrId"
End If
%>
<%
Dim qDental
Dim qDental_cmd
Dim qDental_numRows

Set qDental_cmd = Server.CreateObject ("ADODB.Command"
qDental_cmd.ActiveConnection = MM_datawarehouse_STRING
qDental_cmd.CommandText = "SELECT MbrId, MbrName, ClaimId, ClaimSeqNo, Status, SvcDt, LocDesc, ProvName, ClmType FROM dbo.dw_v_WebMemClmDet with (nolock,INDEX(ak_MV_MbrId)) WHERE MbrId = ? and ClaimSeqNo=1 and ClmType = 'DT' ORDER BY SvcDt desc"
qDental_cmd.Prepared = true
qDental_cmd.Parameters.Append qDental_cmd.CreateParameter("param1", 200, 1, 255, qDental__sMbrid) ' adVarChar

Set qDental = qDental_cmd.Execute
qDental_numRows = 0
%>
<%
Dim qRX__sMbrid
qRX__sMbrid = "1"
If (Session("MbrId" <> "" Then
qRX__sMbrid = Session("MbrId"
End If
%>
<%
Dim qRX
Dim qRX_cmd
Dim qRX_numRows

Set qRX_cmd = Server.CreateObject ("ADODB.Command"
qRX_cmd.ActiveConnection = MM_datawarehouse_STRING
qRX_cmd.CommandText = "SELECT MbrId, MbrName, ClaimId, ClaimSeqNo, Status, SvcDt, LocDesc, ProvName, ClmType FROM dbo.dw_v_WebMemClmDet with (nolock,INDEX(ak_MV_MbrId)) WHERE MbrId = ? and ClaimSeqNo=1 and ClmType = 'RX' ORDER BY SvcDt desc"
qRX_cmd.Prepared = true
qRX_cmd.Parameters.Append qRX_cmd.CreateParameter("param1", 200, 1, 255, qRX__sMbrid) ' adVarChar

Set qRX = qRX_cmd.Execute
qRX_numRows = 0
%>
<%
Dim qVision__sMbrid
qVision__sMbrid = "1"
If (Session("MbrId" <> "" Then
qVision__sMbrid = Session("MbrId"
End If
%>
<%
Dim qVision
Dim qVision_cmd
Dim qVision_numRows

Set qVision_cmd = Server.CreateObject ("ADODB.Command"
qVision_cmd.ActiveConnection = MM_datawarehouse_STRING
qVision_cmd.CommandText = "SELECT MbrId, MbrName, ClaimId, ClaimSeqNo, Status, SvcDt, LocDesc, ProvName, ClmType FROM dbo.dw_v_WebMemClmDet with (nolock,INDEX(ak_MV_MbrId)) WHERE MbrId = ? and ClaimSeqNo=1 and ClmType = 'VT' ORDER BY SvcDt desc"
qVision_cmd.Prepared = true
qVision_cmd.Parameters.Append qVision_cmd.CreateParameter("param1", 200, 1, 255, qVision__sMbrid) ' adVarChar

Set qVision = qVision_cmd.Execute
qVision_numRows = 0
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = 10
Repeat2__index = 0
qDental_numRows = qDental_numRows + Repeat2__numRows
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
qMemClm_numRows = qMemClm_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim qMemClm_total
Dim qMemClm_first
Dim qMemClm_last

' set the record count
qMemClm_total = qMemClm.RecordCount

' set the number of rows displayed on this page
If (qMemClm_numRows < 0) Then
qMemClm_numRows = qMemClm_total
Elseif (qMemClm_numRows = 0) Then
qMemClm_numRows = 1
End If

' set the first and last displayed record
qMemClm_first = 1
qMemClm_last = qMemClm_first + qMemClm_numRows - 1

' if we have the correct record count, check the other stats
If (qMemClm_total <> -1) Then
If (qMemClm_first > qMemClm_total) Then
qMemClm_first = qMemClm_total
End If
If (qMemClm_last > qMemClm_total) Then
qMemClm_last = qMemClm_total
End If
If (qMemClm_numRows > qMemClm_total) Then
qMemClm_numRows = qMemClm_total
End If
End If
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim qDental_total
Dim qDental_first
Dim qDental_last

' set the record count
qDental_total = qDental.RecordCount

' set the number of rows displayed on this page
If (qDental_numRows < 0) Then
qDental_numRows = qDental_total
Elseif (qDental_numRows = 0) Then
qDental_numRows = 1
End If

' set the first and last displayed record
qDental_first = 1
qDental_last = qDental_first + qDental_numRows - 1

' if we have the correct record count, check the other stats
If (qDental_total <> -1) Then
If (qDental_first > qDental_total) Then
qDental_first = qDental_total
End If
If (qDental_last > qDental_total) Then
qDental_last = qDental_total
End If
If (qDental_numRows > qDental_total) Then
qDental_numRows = qDental_total
End If
End If
%>

<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (qMemClm_total = -1) Then

' count the total records by iterating through the recordset
qMemClm_total=0
While (Not qMemClm.EOF)
qMemClm_total = qMemClm_total + 1
qMemClm.MoveNext
Wend

' reset the cursor to the beginning
If (qMemClm.CursorType > 0) Then
qMemClm.MoveFirst
Else
qMemClm.Requery
End If

' set the number of rows displayed on this page
If (qMemClm_numRows < 0 Or qMemClm_numRows > qMemClm_total) Then
qMemClm_numRows = qMemClm_total
End If

' set the first and last displayed record
qMemClm_first = 1
qMemClm_last = qMemClm_first + qMemClm_numRows - 1

If (qMemClm_first > qMemClm_total) Then
qMemClm_first = qMemClm_total
End If
If (qMemClm_last > qMemClm_total) Then
qMemClm_last = qMemClm_total
End If

End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (qDental_total = -1) Then

' count the total records by iterating through the recordset
qDental_total=0
While (Not qDental.EOF)
qDental_total = qDental_total + 1
qDental.MoveNext
Wend

' reset the cursor to the beginning
If (qDental.CursorType > 0) Then
qDental.MoveFirst
Else
qDental.Requery
End If

' set the number of rows displayed on this page
If (qDental_numRows < 0 Or qDental_numRows > qDental_total) Then
qDental_numRows = qDental_total
End If

' set the first and last displayed record
qDental_first = 1
qDental_last = qDental_first + qDental_numRows - 1

If (qDental_first > qDental_total) Then
qDental_first = qDental_total
End If
If (qDental_last > qDental_total) Then
qDental_last = qDental_total
End If

End If
%>


<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

Set MM_rs = qDental
MM_rsCount = qDental_total
MM_size = qDental_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "" Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index"
If (MM_param = "" Then
MM_param = Request.QueryString("offset"
End If
If (MM_param <> "" Then
MM_offset = Int(MM_param)
End If

' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend

' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If

' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If

' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
qDental_first = MM_offset + 1
qDental_last = MM_offset + MM_size

If (MM_rsCount <> -1) Then
If (qDental_first > MM_rsCount) Then
qDental_first = MM_rsCount
End If
If (qDental_last > MM_rsCount) Then
qDental_last = MM_rsCount
End If
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev

Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "" Then
MM_paramList = Split(MM_keepMove, "&"
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=" - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "" Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If

' set the strings for the move to links
If (MM_keepMove <> "" Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If

MM_urlStr = Request.ServerVariables("URL" & "?" & MM_keepMove & MM_moveParam & "="

MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Claims</title>

<link href="tab.css" rel="stylesheet" type="text/css"/>
<script src="tabs.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style1 {
color: #003366;
font-weight: bolder;
font-size: 16px;
font-family: Arial, Helvetica, sans-serif;
}
.style2 {
font-size: 13px;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
}
a:hover {
background-color: #4682b4;
color: #FFFFFF;
text-decoration: none;
}
a:visited {
color: #003366;
text-decoration: none;
}
a:link {
color: #003366;
text-decoration: none;
}

-->
</style>
</head>
<body>
<h2 class="style1">Claim Search for <%= Session("MbrName" %></h2>
<ul id="toc" class="style2">
<li><a href="#page_1">Medical Claims</a></li>
<% If Not qDental.EOF Or Not qDental.BOF Then %>
<li><a href="#page_2">Dental Claims</a></li>
<% End If ' end Not qDental.EOF Or NOT qDental.BOF %>
<% If Not qVision.EOF Or Not qVision.BOF Then %>
<li><a href="#page_3">Vision Claims</a></li>
<% End If ' end Not qVision.EOF Or NOT qVision.BOF %>
<% If Not qRX.EOF Or Not qRX.BOF Then %>
<li><a href="#page_4">Pharmacy Claims</a></li>
<% End If ' end Not qRX.EOF Or NOT qRX.BOF %>
</ul>
<div class="content" id="page_1">
<div style="width:650px;padding:10px;filter:shadow(color:#4682B4,strength:10, direction:135);">
<div style="width:625px;text-align:left;padding:10px;background-color:white;border:1px solid #4682B4;font-size:13px;color:#003366;font-family:Arial, Helvetica, sans-serif;">
<A HREF="<%=MM_movePrev%>"><img src="images/backbutton.png" alt="Previous" width="30" height="21" border="0" align="texttop" /></A> Items <%=(qMemClm_first)%> to <%=(qMemClm_last)%>
<A HREF="<%=MM_moveNext%>"><img src="images/forwardbutton.png" alt="Next" width="30" height="21" border="0" align="texttop" /></A> Total items <%=(qMemClm_total)%>
<br /><hr color="#4682b4"/>
<table width="625" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">Claim Number</th>
<th scope="col">Date of Service</th>
<th scope="col">Claim Status</th>
<th scope="col">Place of Service</th>
<th scope="col">Provider Name</th>
</tr>
<% If Not qMemClm.EOF Or Not qMemClm.BOF Then %>
<%
While ((Repeat1__numRows <> 0) AND (NOT qMemClm.EOF))
%>
<tr>
<td><a href="ClaimInquiry.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "ClaimId=" & qMemClm.Fields.Item("ClaimId".Value %>"><%=(qMemClm.Fields.Item("ClaimId".Value)%></a></td>
<td><%=(qMemClm.Fields.Item("SvcDt".Value)%></td>
<td><%=(qMemClm.Fields.Item("Status".Value)%></td>
<td><%=(qMemClm.Fields.Item("LocDesc".Value)%></td>
<td><%=(qMemClm.Fields.Item("ProvName".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
qMemClm.MoveNext()
Wend
%>

<% End If ' end Not qMemClm.EOF Or NOT qMemClm.BOF %>
</table>

</div>
</div>
</div>
<div class="content" id="page_2">
<div style="width:650px;padding:10px;filter:shadow(color:#4682B4,strength:10, direction:135);">
<div style="width:625px;text-align:left;padding:10px;background-color:white;border:1px solid #4682B4;font-size:13px;color:#003366;font-family:Arial, Helvetica, sans-serif;">
<A HREF="<%=MM_movePrev%>"><img src="images/backbutton.png" alt="Previous" width="30" height="21" border="0" align="texttop" /></A> Items <%=(qDental_first)%> to <%=(qDental_last)%>
<A HREF="<%=MM_moveNext%>"><img src="images/forwardbutton.png" alt="Next" width="30" height="21" border="0" align="texttop" /></A> Total items <%=(qDental_total)%><br />
<hr color="#4682b4"/>
<table width="625" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">Claim Number</th>
<th scope="col">Date of Service</th>
<th scope="col">Claim Status</th>
<th scope="col">Place of Service</th>
<th scope="col">Provider Name</th>
</tr>
<% If Not qDental.EOF Or Not qDental.BOF Then %>
<%
While ((Repeat2__numRows <> 0) AND (NOT qDental.EOF))
%>
<tr>
<td><a href="ClaimInquiry.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "ClaimId=" & qDental.Fields.Item("ClaimId".Value %>"><%=(qDental.Fields.Item("ClaimId".Value)%></a></td>
<td><%=(qDental.Fields.Item("SvcDt".Value)%></td>
<td><%=(qDental.Fields.Item("Status".Value)%></td>
<td><%=(qDental.Fields.Item("LocDesc".Value)%></td>
<td><%=(qDental.Fields.Item("ProvName".Value)%></td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
qDental.MoveNext()
Wend
%>
<% End If ' end Not qDental.EOF Or NOT qDental.BOF %>
</table>

</div>
</div>
</div>
</body>
</html>
<%
qMemClm.Close()
Set qMemClm = Nothing
%>
<%
qDental.Close()
Set qDental = Nothing
%>
<%
qRX.Close()
Set qRX = Nothing
%>
<%
qVision.Close()
Set qVision = Nothing
%>

Reply to this topic