• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Next/Previous buttons not working right

I have the following code in my page to create a next record link and a previous record link.  the problem Im having is that the tranid in the url is not incrementing the next tranid from the query, but when I click next, the cfoutput field being displayed does increment to the next tranid.  Any help would be great!! Thank you.
<cfquery name="getTranid" datasource="#Application.dsname#">  
  		SELECT tranid FROM #session.APAlerts# WHERE d_lbxname = '#URL.lbxname#'
    </cfquery>
 
    <cfparam NAME ="MaxRows" default="1">
    <cfparam NAME ="StartRow" default="1">
    
	<cfoutput query="getTranid" startrow="#StartRow#" maxrows="#MaxRows#">
    #getTranid.currentRow# --- #tranid#<BR>
    </cfoutput>
 
	<cfoutput>
 
          <cfif (StartRow+MaxRows) lte getTranid.recordcount>
          	<cfif #StartRow# gt 1>
            	<td width="100" ><cfoutput> <a href="transdetail_al.cfm?ID=#getTranid.tranid#&lbxname=#session.lbxname#&StartRow=<cfoutput>#evaluate(StartRow-MaxRows)#</cfoutput>" class="hibMenu">Previous Trans</a> </cfoutput> </td>
          	</cfif>
            <td width="100"><cfoutput> <a href="transdetail_al.cfm?ID=#getTranid.tranid#&lbxname=#session.lbxname#&StartRow=<cfoutput>#evaluate(StartRow+MaxRows)#</cfoutput>" class="hibMenu">Next Trans</a> </cfoutput> </td>
          </cfif>

Open in new window

0
Cashmgmt
Asked:
Cashmgmt
  • 3
  • 3
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
check the dataabse if there any duplicate records for the tranid
0
 
CashmgmtAuthor Commented:
No, there arent any duplicates.  and I have the current tranid showing on the page and everytime I click the next button, it displays the correct tranid, It's just not putting the next tranid in the link.  it's always displaying the same one.
0
 
erikTsomikSystem Architect, CF programmer Commented:
ok. try to do this . Include the links inside of the cfoutput query
<cfoutput query="getTranid" startrow="#StartRow#" maxrows="#MaxRows#">
    #getTranid.currentRow# --- #tranid#<BR>
 
 
        <cfoutput>
 
          <cfif (StartRow+MaxRows) lte getTranid.recordcount>
                <cfif #StartRow# gt 1>
                <td width="100" ><cfoutput> <a href="transdetail_al.cfm?ID=#getTranid.tranid#&lbxname=#session.lbxname#&StartRow=<cfoutput>#evaluate(StartRow-MaxRows)#</cfoutput>" class="hibMenu">Previous Trans</a> </cfoutput> </td>
                </cfif>
            <td width="100"><cfoutput> <a href="transdetail_al.cfm?ID=#getTranid.tranid#&lbxname=#session.lbxname#&StartRow=<cfoutput>#evaluate(StartRow+MaxRows)#</cfoutput>" class="hibMenu">Next Trans</a> </cfoutput> </td>
          </cfif>
  </cfoutput>
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
CashmgmtAuthor Commented:
I changed the link to this:

<a href="transdetail_al.cfm?ID=#getTranid['tranid'][getTranid.currentRow-1]# for previous
<a href="transdetail_al.cfm?ID=#getTranid['tranid'][getTranid.currentRow+1]# for next

if I'm on the first record, the next link will have the next tranid and startrow=2 which is right, but once i click the next link, the tranid will no longer increment, but the startrow will go to 3.  so I'm closer, but still not working.
0
 
erikTsomikSystem Architect, CF programmer Commented:
why don't you put the links inside the cfoutput query
0
 
CashmgmtAuthor Commented:
that was it!!!!! awesome!!!! thank you very much for your help!!!!!!!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now