MACROMEDIA COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX Getting Started page 112

Building coldfusion mx applications
Table of Contents

Advertisement

Navigation button
Next Row
Last Row
Limiting the number of result rows
Each of the SQL statements in the previous table return a result set of trips rows. The result set
can range from zero to any number of rows. The navigation action page must limit the result set
count to 1, since only the initial row in the result set is needed for the Trip Detail page display.
ColdFusion provides the
limits the number of result rows returned from the database. To show only a single row at a time
in the Trip Detail page, set
The navigation action page
To properly build the SQL SELECT statement for previous and next row navigation, you must
know the current
Detail page. You can then use the form variable
for building the proper test in the WHERE clause of the SQL SELECT statement. The following
code (from navigationaction.cfm) processes the navigation button requests on the Trip Detail
page:
<!---
NAVIGATION BUTTONS --->
<cfquery name="TripQuery" dataSource="compasstravel" maxRows=1>
SELECT tripID FROM trips
<cfif IsDefined("Form.btnPrev.X")>
WHERE tripID < #Form.RecordID#
ORDER BY tripID DESC
<cfelseif IsDefined("Form.btnNext.X")>
WHERE tripID > #Form.RecordID#
ORDER BY tripID
<cfelseif IsDefined("Form.btnFirst.X")>
ORDER BY tripID
<cfelseif IsDefined("Form.btnLast.X")>
ORDER BY tripID DESC
</cfif>
</cfquery>
<cfif TripQuery.RecordCount is 1>
<cflocation url="tripdetail.cfm?ID=#TripQuery.tripID#">
<cfelse>
<cflocation url="tripdetail.cfm?ID=#Form.RecordID#">
</cfif>
112
Chapter 9: Lesson 5: Implementing the Browsing and Maintenance Database Functions
SQL statement to navigate to
correct trip ID
SELECT tripID FROM trips
WHERE tripID > 6
ORDER BY tripID
SELECT tripID FROM trips
ORDER BY tripID DESC
attribute on the
maxRows
to 1.
maxRows
. This is the reason for using the hidden input tag
tripID
SQL statement description
Returns the list of all
in ascending (7,8,9...) order.
Returns the list of all
(99,98,97...) order.
tag for this purpose. This attribute
cfquery
in the navigation action page
#Form.RecordID#
greater than 6
tripIDs
in descending
tripIDs
on the Trip
RecordID

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents