|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a list of records that are displayed on a web page. At present they are ordered by date. However, I wish to offer the user the ability to select a column heading to change the sorting method.
I do not want to have multiple pages with seperate queries embedded in order to do this. I simply want to pass a URL paramtered to the same page which indicates which attribute to sort on. Of the form: select * FROM tbl SORT BY #'URL.SORT'#. However, this seems to generate a Coldfusion error when I test the query in Dreamweaver using DATE as the default parameter. Where am I going wrong?? |
|
#2
|
|||
|
|||
|
Success
Got it...
select * FROM tbl SORT BY #URL.SORT#. Shouldn't have put the apostrophes in.... |
|
#3
|
|||
|
|||
|
I'm trying to do the same thing with forms that I currently have seperate pages for. The current CF query looks like this:
<cfquery name="getunapproved" datasource="RAdata" dbtype="OLEDB"> SELECT * FROM tblProgram WHERE (((tblProgram.acemail)="#session.acemail#")) ORDER BY programmername, date DESC </cfquery> I would like to input a variable or two variables in place of the above "programmername" and "date". I tried your suggestion with putting in Sort By #URL.SORT# in place of Order By, but it still flagged URL.SORT as a CF Error. Any help would be greatly appreciated. |
|
#4
|
|||
|
|||
|
Did you use pound signs?
<cfquery name="getunapproved" datasource="RAdata" dbtype="OLEDB"> SELECT * FROM tblProgram WHERE tblProgram.acemail = '#session.acemail#' ORDER BY #url.sortByField# </cfquery>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#5
|
|||
|
|||
|
Quote:
I gave that a try... no luck. Here's the Error. -------------------------------------------- Error Occurred While Processing Request Error Diagnostic Information An error occurred while evaluating the expression: #URL.SORTBYFIELD# Error near line 7, column 11. -------------------------------------------------------------------------------- Error resolving parameter URL.SORTBYFIELD The specified URL parameter cannot be found. This problem is very likely due to the fact that you have misspelled the parameter name. The error occurred while processing an element with a general identifier of (#URL.SORTBYFIELD#), occupying document position (7:10) to (7:26). |
|
#6
|
|||
|
|||
|
Figured it out... needed to put a ?sortbyfield= into the url before it would open. I'll probably write a CFIF to prevent that problem. Thanks
|
|
#7
|
|||
|
|||
|
You can also use cfparam on your query page to set up a default value for url.sortByField if it does not exist.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Sorting Records |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|