?
Solved

Is there an easy way re-order data -- using the same ColdFusion template?

Posted on 2008-06-22
7
Medium Priority
?
198 Views
Last Modified: 2012-06-27
Hi. I have a simple ColdFusion application that displays data from a database:

http://ascassociation.org/chicagoOct2008_view_registration.cfm

(Code snippet attached. This page, when it launches later this week, will be secured by HTTPS.)

Currently this CF template sorts information by RegistrationID.

I want to offer the user the ability to sort information by Date Submitted | Name | Facility / Company.

(See the links at the top of the page.)

I could write three other templates to sort the information in these three different ways.

But, is there an easier way?

I am thinking some kind of CFIF statement would do. IF the user clicks here, THEN she sees the information sorted by Name. Etc.

But I am not sure how to code that. Or if this is the right path.

Does anybody have advice regarding this?

I'd like to try very hard to learn this task well. Rather than supplying me code, can you give me a hint, or start me off in a way that allows me to teach myself? This improves my education.

Thanks very much!

Peace,

Eric
<cfinclude template="/SiteHeader.cfm">
 
<p class="align-center">[ Sort By: <a href="/chicagoOct2008_view_registration.cfm">Registration ID</a> | <a href="#">Date Submitted</a> | <a href="#">Name</a> | <a href="#">Facility / Company</a> ]</p>
 
 
 <!--- Display values into database columns --->
<cfquery datasource="ebwebwork" dbname="ascassociation" name="viewRegistration">
	SELECT RegistrationID,
		Name,
		Degree,
		Title,
		FacilityCompany,
		Address1,
		Address2,
		City,
		State,
		Zip,
		Phone,
		Fax,
		Email,
		WebSite,
		MainConference1stAttendeeAmountBefore8Sep625,
		MainConference2ndAttendeeAmountBefore8Sep575,
		MainConference3rdAttendeeAmountBefore8Sep525,
		MainConference4thAttendeeAmountBefore8Sep500,
		MainConference1stAttendeeAmountAfter8Sep725,
		MainConference2ndAttendeeAmountAfter8Sep675,
		MainConference3rdAttendeeAmountAfter8Sep625,
		MainConference4thAttendeeAmountAfter8Sep600,
		MainandPreConference1stAttendeeAmountBefore8Sep825,
		MainandPreConference2ndAttendeeAmountBefore8Sep775,
		MainandPreConference3rdAttendeeAmountBefore8Sep725,
		MainandPreConference4thAttendeeAmountBefore8Sep700,
		MainandPreConference1stAttendeeAmountAfter8Sep975,
		MainandPreConference2ndAttendeeAmountAfter8Sep875,
		MainandPreConference3rdAttendeeAmountAfter8Sep825,
		MainandPreConference4thAttendeeAmountAfter8Sep800,
		BeckersASCReviewSpecialDiscount,
		ASCReviewSubscriberDiscountFifty,
		TotalEnclosed,
		CheckEnclosed,
		CheckNumber,
		AuthorizeCharge,
		CreditCard,
		CreditCardNumber,
		ExpirationDate,
		PrintedCardHolderName,
		CreditCardZIPCode,
		CVV,
		DateCreated
		
FROM RegistrationEntries
ORDER BY RegistrationID
 
</cfquery>
 
 
 
 
 
<cfoutput query="viewRegistration">
 
	  <cfif CurrentRow MOD 2 IS 1>
<cfset bgcolor="##FFFFFF">
<cfelse>
<cfset bgcolor="##ebebeb">
</cfif>
 
<p style="background-color:#bgcolor#;padding:10px;margin:20px 0;">
 
<strong>RegistrationID:</strong> #RegistrationID# [<a href="deleteChicagoRegOct2008.cfm?RegistrationID=#RegistrationID#" onclick="return confirm('Are you sure you want to delete this Registration Entry?')">Delete</a>]
 
<br />
<strong>Name:</strong> #Name#<br />
<strong>Degree:</strong> #Degree#<br />
<strong>Title:</strong> #Title#<br />
<CFIF FacilityCompany IS NOT ""><strong>Facility / Company:</strong> #FacilityCompany#<br /></CFIF>
<strong>Address Line 1:</strong> #Address1#<br />
<CFIF Address2 IS NOT ""><strong>Address Line 2:</strong> #Address2#<br /></CFIF>
<strong>City:</strong> #City#<br />
<strong>State:</strong> #State#<br />
<strong>Zip:</strong> #Zip#<br />
<strong>Phone:</strong> #Phone#<br />
<CFIF Fax IS NOT ""><strong>Fax:</strong> #Fax#<br /></CFIF>
<strong>Email:</strong> #Email#<br />
<CFIF WebSite IS NOT ""><strong>Web Site:</strong> #WebSite#<br /></CFIF>
<CFIF MainConference1stAttendeeAmountBefore8Sep625 IS NOT ""><strong>Main Conference 1st Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainConference1stAttendeeAmountBefore8Sep625#<br /></CFIF>
<CFIF MainConference2ndAttendeeAmountBefore8Sep575 IS NOT ""><strong>Main Conference 2nd Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainConference2ndAttendeeAmountBefore8Sep575#<br /></CFIF>
<CFIF MainConference3rdAttendeeAmountBefore8Sep525 IS NOT ""><strong>Main Conference 3rd Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainConference3rdAttendeeAmountBefore8Sep525#<br /></CFIF>
<CFIF MainConference4thAttendeeAmountBefore8Sep500 IS NOT ""><strong>Main Conference 4th Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainConference4thAttendeeAmountBefore8Sep500#<br /></CFIF>
<CFIF MainConference1stAttendeeAmountAfter8Sep725 IS NOT ""><strong>Main Conference 1st Attendee Amount Remitted After 8 Sep 2008:</strong> #MainConference1stAttendeeAmountAfter8Sep725#<br /></CFIF>
<CFIF MainConference2ndAttendeeAmountAfter8Sep675 IS NOT ""><strong>Main Conference 2nd Attendee Amount Remitted After 8 Sep 2008:</strong> #MainConference2ndAttendeeAmountAfter8Sep675#<br /></CFIF>
<CFIF MainConference3rdAttendeeAmountAfter8Sep625 IS NOT ""><strong>Main Conference 3rd Attendee Amount Remitted After 8 Sep 2008:</strong> #MainConference3rdAttendeeAmountAfter8Sep625#<br /></CFIF>
<CFIF MainConference4thAttendeeAmountAfter8Sep600 IS NOT ""><strong>Main Conference 4th Attendee Amount Remitted After 8 Sep 2008:</strong> #MainConference4thAttendeeAmountAfter8Sep600#<br /></CFIF>
<CFIF MainandPreConference1stAttendeeAmountBefore8Sep825 IS NOT ""><strong>Main and PreConference 1st Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainandPreConference1stAttendeeAmountBefore8Sep825#<br /></CFIF>
<CFIF MainandPreConference2ndAttendeeAmountBefore8Sep775 IS NOT ""><strong>Main and PreConference 2nd Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainandPreConference2ndAttendeeAmountBefore8Sep775#<br /></CFIF>
<CFIF MainandPreConference3rdAttendeeAmountBefore8Sep725 IS NOT ""><strong>Main and PreConference 3rd Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainandPreConference3rdAttendeeAmountBefore8Sep725#<br /></CFIF>
<CFIF MainandPreConference4thAttendeeAmountBefore8Sep700 IS NOT ""><strong>Main and PreConference 4th Attendee Amount Remitted Before 8 Sep 2008:</strong> #MainandPreConference4thAttendeeAmountBefore8Sep700#<br /></CFIF>
<CFIF MainandPreConference1stAttendeeAmountAfter8Sep975 IS NOT ""><strong>Main and PreConference 1st Attendee Amount Remitted After 8 Sep 2008:</strong> #MainandPreConference1stAttendeeAmountAfter8Sep975#<br /></CFIF>
<CFIF MainandPreConference2ndAttendeeAmountAfter8Sep875 IS NOT ""><strong>Main and PreConference 2nd Attendee Amount Remitted After 8 Sep 2008:</strong> #MainandPreConference2ndAttendeeAmountAfter8Sep875#<br /></CFIF>
<CFIF MainandPreConference3rdAttendeeAmountAfter8Sep825 IS NOT ""><strong>Main and PreConference 3rd Attendee Amount Remitted After 8 Sep 2008:</strong> #MainandPreConference3rdAttendeeAmountAfter8Sep825#<br /></CFIF>
<CFIF MainandPreConference4thAttendeeAmountAfter8Sep800 IS NOT ""><strong>Main and PreConference 4th Attendee Amount Remitted After 8 Sep 2008:</strong> #MainandPreConference4thAttendeeAmountAfter8Sep800#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Beckers ASC Review Special Discount:</strong> #BeckersASCReviewSpecialDiscount#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>ASC Review Subscriber Discount ($50):</strong> #ASCReviewSubscriberDiscountFifty#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Total Enclosed:</strong> #TotalEnclosed#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Check Enclosed:</strong> #CheckEnclosed#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Check Number:</strong> #CheckNumber#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Authorize Charge:</strong> #AuthorizeCharge#<br /></CFIF>
<CFIF FacilityCompany IS NOT ""><strong>Credit Card:</strong> #CreditCard#<br /></CFIF>
<CFIF CreditCardNumber IS NOT ""><strong>Credit Card Number:</strong>#CreditCardNumber#<br /></CFIF>
<CFIF ExpirationDate IS NOT ""><strong>Expiration Date:</strong>#ExpirationDate#<br /></CFIF>
<CFIF PrintedCardHolderName IS NOT ""><strong>Printed Card Holder Name:</strong> #PrintedCardHolderName#<br /></CFIF>
<CFIF CreditCardZIPCode IS NOT ""><strong>Credit Card ZIP Code:</strong> #CreditCardZIPCode#<br /></CFIF>
<CFIF CVV IS NOT ""><strong>CVV:</strong> #CVV#<br /></CFIF>
<strong>Date Submitted:</strong> #DateCreated#
 
  </p>
</cfoutput>
  
 
 
 
<cfinclude template="/SiteFooter.cfm">

Open in new window

0
Comment
Question by:Eric Bourland
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 21843576
Sorry to give you code :)



<p class="align-center">[ Sort By: <a href="?sort=RegistrationID">Registration ID</a> | <a href="?sort=DateCreated">Date Submitted</a> | <a href="?sort=Name">Name</a> | <a href="?sort=FacilityCompany">Facility / Company</a> ]</p>
 
<cfparam name="url.sort" default="RegistrationID" >



....
            
FROM RegistrationEntries
ORDER BY #url.sort#
 
</cfquery>

0
 
LVL 3

Author Comment

by:Eric Bourland
ID: 21843592
Interesting. I'm going to work on this. Thank you Zvonko.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21843618
You are welcome.
0
How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

 
LVL 3

Author Comment

by:Eric Bourland
ID: 21852527
Hi, Zvonko,

Today was a very hectic day, which is not yet over. I will get time to work on your ideas tomorrow. Thanks for your ideas and guidance.

More tomorrow. Have a good evening.

Best from Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
ID: 21856182
Zvonko, this worked gorgeously and made sense. Thank you.

http://ascassociation.org/chicagoOct2008_view_registration.cfm?sort=DateCreated

Have a great day.

Eric
0
 
LVL 3

Author Closing Comment

by:Eric Bourland
ID: 31469624
Very useful solution.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21856451
Thank you for the feedback Eric.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question