ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 4th, 2005, 07:08 AM
Merlincraft Merlincraft is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 65 Merlincraft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 14 m 53 sec
Reputation Power: 4
Question Sorting Records

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??

Reply With Quote
  #2  
Old February 4th, 2005, 07:27 AM
Merlincraft Merlincraft is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 65 Merlincraft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 14 m 53 sec
Reputation Power: 4
Success

Got it...

select * FROM tbl SORT BY #URL.SORT#.

Shouldn't have put the apostrophes in....

Reply With Quote
  #3  
Old February 16th, 2005, 10:44 AM
niceorange niceorange is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 5 niceorange User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 4 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old February 16th, 2005, 11:47 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
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

Reply With Quote
  #5  
Old February 16th, 2005, 12:12 PM
niceorange niceorange is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 5 niceorange User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 4 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
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>


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).

Reply With Quote
  #6  
Old February 16th, 2005, 01:33 PM
niceorange niceorange is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 5 niceorange User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 4 sec
Reputation Power: 0
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

Reply With Quote
  #7  
Old February 16th, 2005, 02:57 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
You can also use cfparam on your query page to set up a default value for url.sortByField if it does not exist.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Sorting Records


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT