[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Next/Previous record in Coldfusion

Asked by diecasthft in Cold Fusion Markup Language

Tags: coldfusion, next, previous, record

I have an issue with my next record code in Coldfusion. I have a database with electronics information in it at several installations...so installation 1 might have 10 pieces of electronics. I distinguish the different pieces by what building they're located in. So I have a page that allows me to search by installation, and then it returns a list of all of the electronics at that installation. I have an edit link where I can open a specific record and I pass the installation name and ther building number thru the url. My problem is that I want to have a next/previous button at the top of the edit page that opens when I select the edit button. If I select the edit button on a building number in the middle of the installation list, it automatically opens the first record of the query, not the record I selected in the list. If I add a where clause in my query to include the building number, then I get the right record, but then only one record shows up and therefore there is no next/previous button to get to the next record in the query. Can I use the next/previous while still starting in the middle of a recordset?? Below is my code....any help would be greatly appreciated...I've been fighting this for some time now......

editDSN -----------------------

<CFSET EditMode=IsDefined("URL.INSTALLATION_NAME")>
<CFSET EditMode=IsDefined("URL.BUILDING")>

<CFIF EditMode>

<cfset SESSION.urlpass.INSTALLATION_NAME = URL.INSTALLATION_NAME>
<cfset SESSION.urlpass.BUILDING = URL.BUILDING>

<CFSET ORGANIZATION=Trim(DSNedit.ORGANIZATION)>
    <CFSET STREET_ADDRESS=Trim(DSNedit.STREET_ADDRESS)>
      <CFSET BLDGNO=Trim(DSNedit.BLDGNO)>
      <CFSET CITY=Trim(DSNedit.CITY)>
      <CFSET STATE=Trim(DSNedit.STATE)>
      <CFSET ZIP_CODE=Trim(DSNedit.ZIP_CODE)>
      <CFSET RCIO_REGION=Trim(DSNedit.RCIO_REGION)>

<CFSET FormTitle="Update Installation">
    <CFSET ButtonText="Update">
   
<CFELSE>

<CFSET ORGANIZATION="">
    <CFSET STREET_ADDRESS="">
      <CFSET BLDGNO="">
      <CFSET CITY="">
      <CFSET STATE="">
      <CFSET ZIP_CODE="">
      <CFSET RCIO_REGION="">

<CFSET FormTitle="Add an Installation">
    <CFSET ButtonText="Insert">

</CFIF>

<cfquery name="IDDB" datasource="DSNSwitch_PM">
SELECT DISTINCT ORGANIZATION
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>

<cfquery name="Addr1" datasource="DSNSwitch_PM">
SELECT DISTINCT STREET_ADDRESS
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>

<cfquery name="Cityfield" datasource="DSNSwitch_PM">
SELECT DISTINCT CITY
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>

<cfquery name="Statefield" datasource="DSNSwitch_PM">
SELECT DISTINCT STATE
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>

<cfquery name="Zipfield" datasource="DSNSwitch_PM">
SELECT DISTINCT ZIP_CODE
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>

<cfquery name="Regionfield" datasource="DSNSwitch_PM">
SELECT DISTINCT RCIO_REGION
FROM DSNSWITCH_PM.POC_INFORMATION
</cfquery>


<CFQUERY DATASOURCE="DSNSwitch_PM" NAME="GetCount">
SELECT *
FROM DSNSWITCH_PM.POC_INFORMATION
WHERE POC_INFORMATION.ORGANIZATION='#URL.INSTALLATION_NAME#'
AND POC_INFORMATION.BLDGNO='#URL.BUILDING#'
</CFQUERY>
      
<CFSET recordperpage = 1>

<CFPARAM NAME="URL.startrow" default="1" type="numeric">
<CFSET totalRows = GetCount.recordCount>

<CFSET endRow = min(URL.startrow + recordperpage -1, totalRows)>

<CFSET startRowNext = endRow + 1>

<CFSET startRowBack = URL.startRow - recordperpage>

<html>
<head>
<title>Untitled Document</title>

<body>
<cfform name="InstallationForm" action="LMRUpdate.cfm" method="post">

<table width="800"><td>
<h3><span class="style1 style7">Information for</span> <CFOUTPUT><span class="style1 style2">#ORGANIZATION#</span>;<BR>
</CFOUTPUT></td>
<tr><td><cfoutput>
<span class="style10">Displaying</span> <span class="style7 style1 style8"><strong>#URL.startRow#</strong></span>
<span class="style10 style7">of</span> <span class="style7 style1"><strong><span class="style2">#totalRows#</span></strong></span> <span class="style10">Record(s)</span>
</cfoutput>

<cfinclude template="NextNIncludeBackNext1.cfm"></td></tr>
</table>      
<cfloop query="GetCount" startRow="#startRow#" endRow="#endRow#">      

---- BUNCH OF FORM FIELDS HERE -----

</cfloop>
</body>
</CFFORM>
</html>

Then my nextininclude template --------------------

<cfset SESSION.urlpass.INSTALLATION_NAME = URL.INSTALLATION_NAME>
<cfset SESSION.urlpass.BUILDING = URL.BUILDING>

<cfoutput>
<cfif startRowBack gt 0>
<a href="#CGI.script_name#?ARMY_INSTALLATION_NAME=#SESSION.urlpass.INSTALLATION_NAME#&BUILDING=#SESSION.urlpass.BUILDING#&startRow=#startRowBack#">
<img src="../../Images/BrowseBack.gif" width="40" height="16" alt="Previous Record" border="0" /></a>
</cfif>

<cfif startRowNext lte totalRows>
<a href="#CGI.script_name#?ARMY_INSTALLATION_NAME=#SESSION.urlpass.INSTALLATION_NAME#&BUILDING=#SESSION.urlpass.BUILDING#&startRow=#startRowNext#">
<img src="../../Images/BrowseNext.gif" width="40" height="16" alt="Next Record" border="0" /></a>
</cfif>

</cfoutput>
[+][-]03/14/07 09:28 AM, ID: 18719803Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Cold Fusion Markup Language
Tags: coldfusion, next, previous, record
Sign Up Now!
Solution Provided By: stu215
Participating Experts: 1
Solution Grade: A
 
[+][-]09/27/08 08:40 PM, ID: 22589659Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10/02/08 02:16 PM, ID: 22628726Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92