Can you resort a CFQUERY Result

Is it possible to resort a CFquery result without hitting the
DB again?
Already the DB has about 12 million records. I am storing the
output into a session var and passing through other pages. The
problem is when the user wants to resort the output by price, state
or any thing else. I am trying to find a way to resort the Query
without hitting the DB again. Caching is out of the way

You say you are storing the query results in a Session
variable? Give this a try:
<!--- convert session variable to local variable in
<cflock> to ensure the integrity of shared data --->
<cflock timeout="5" type="READONLY" scope="SESSION">
<cfset Variables.QueryResults =
Duplicate(Session.QueryResults)>
</cflock>
<!--- default sorting variables --->
<cfparam name="SortColumn" default="ColumnOne">
<cfparam name="SortOrder" default="ASC">
<!--- validate the sort column is a column in the query
object since users can alter it in the URL during a sort --->
<cfif NOT
ListFindNoCase(Variables.QueryResults.ColumnList, SortColumn)>
<p>The column you wish to sort by:
<cfoutput>#SortColumn#</cfoutput> is invalid in the
query result set.</p>
<cfabort>
</cfif>
<!--- validate the sort order is a valid sort type --->
<cfif NOT ListFindNoCase("ASC,DESC", SortOrder)>
<p>The order you wish to sort by:
<cfoutput>#SortOrder#</cfoutput> is invalid.</p>
<cfabort>
</cfif>
<!--- query of a query example (dbtype="query"), using our
sort params --->
<cfquery name="SortedQueryResults" dbtype="query">
SELECT ColumnOne, ColumnTwo, ColumnThree
FROM Variables.QueryResults
ORDER BY #SortColumn# #SortOrder#
</cfquery>
<!--- form for sorting --->
<form
action="<cfoutput>#CGI.ScriptName#</cfoutput>"
method="get">
Sort by:
<select name="SortColumn">
<cfloop index="i"
list="#SortedQueryResults.ColumnList#">
<cfoutput><option value="#i#" <cfif SortColumn
EQ
i>selected="true"</cfif>>#i#</option></cfoutput>
</cfloop>
</select>
<select name="SortOrder">
<option value="ASC" <cfif SortOrder EQ
"ASC">selected="true"</cfif>>ASC</option>
<option value="DESC" <cfif SortOrder EQ
"DESC">selected="true"</cfif>>DESC</option>
</select>
<input type="submit" value="Sort">
</form>

Similar Messages

  • Can you filter iTunes search results by video or audio podcasts?

    I have been searching for hours and haven't found a definite answer. Anyone know if this is possible?
    Can you filter iTunes search results by video or audio podcasts?

    I'm having the same problem. I go to Podcasts/Video Podcasts/News and they only give the featured, favorites (whose?), etc. I want to see all video news podcasts but if I then click on see all, it drops the video classification and shows all news podcasts. The iTunes search in general leaves a lot to be desired; its not very intuitive or pleasant to use, not the usual Apple experience.

  • Can you refine people search results using a SharePoint 2013 search service application connected in SharePoint 2010?

    We have an SP2010 farm which is now using some of the service applications from an SP2013 farm, including the search, managed metadata and user profile.  This is part of an upgrade programme of work which will involve upgrading infrastructure and
    then gradually the sites, and this is seen as one way to minimise the impact.
    So, the SP2010 search results are being generated by the SP2013 which is indexing the SP2010 content.  The initial results appear fine, however, the refiners in the people results for Job Title and Department are no longer working.  We are receiving
    a 404 page not found, even though the page is there as was working before.
    If we compare the URL generated in SP2010 for refining results to an OOTB SP2013 search centre site, there is clearly a big difference to the format.  Example below is where LastName is Smith and then refined where Department is HR.
    SP2010 URL which now gives a 404 error:
    http://intranet2010/search/pages/peopleresults.aspx?k=LastName%3Asmith&r=%22owstaxIdSPShDepartment%22%3D%23832e3479%2Dd168%2D4620%2Dac69%2D9b00a4c4205b%3A%22HR%22
    OOTB SP2013 URL:
    http://intranet2013/search/pages/peopleresults.aspx?k%3Asmith#Default=%7B%22k%22%3A%22smith%22%2C%22r%22%3A%5B%7B%22n%22%3A%22Department%22%2C%22t%22%3A%5B%22%5C%22%C7%82%C7%824335%5C%22%22%5D%2C%22o%22%3A%22and%22%2C%22m%22%3Anull%2C%22k%22%3Afalse%7D%5D%7D
    I've looked at the URL decoded versions so can see how the query is built up.
    Any ideas?  Is this even possible?
    Matt

    All working now.  Turns out there was an entry in the web.config which was causing issues.
      <denyQueryStringSequences>
          <add sequence="ID" />
      </denyQueryStringSequences>
    Seems IIS is denying something in the query string.  We removed the whole section as was not needed.
    http://www.iis.net/configreference/system.webserver/security/requestfiltering/denyquerystringsequences
    Thanks to a colleague who spotted this; I would've never of thought to check the web.config for something like this.

  • Can you customize Password Reset Results?

    We're migrating our password management stuff into Identity Manager, and one of the nicer features we've got with our current (home-rolled) setup is that after a Help Desk worker resets someone's password, it gives them a nice page that can be printed out and handed to the person to take with them.
    The default password reset page in Identity Manager does print out the password, but I don't see what form I would use to customize that results page. (admin/resetUserPasswordResults.jsp). Does anyone know where to look?
    Thanks!
    Jonathan

    I am having problems in displaying the new password. I want to use a custom password policy to generate the new password. I call a custom reset password workflow, and pass that policy to it. It generates two diff password. one for IdM and one for LDAP. I want it to generate one password for both

  • Result set --- can you reference in two locations (jsp and doVIew())

    I need help figuring out what I am doing wrong.
    In my doView() function I am saving a result set
      NamingEnumeration person = details.executeDetails(fullname);I need to reference this result set from my doView method and inside my jsp page, this is why I have stored this inside a session variable.
    //doView() method
    NamingEnumeration person = details.executeDetails(fullname);
    if(person != null){                           
      while(person.hasMore()){
       SearchResult sr = (SearchResult)person.next();
       Attributes attributes = sr.getAttributes();
       Attribute attr = attributes.get("x500UniqueIdentifier");
       if (attr != null) {
        Object val = attr.get();
        byte[] buf = (byte[])val;
        String number = new String(buf);
        person_number = removeLeadingZeros(number);
    person.close();
    session.setAttribute("person", person, PortletSession.PORTLET_SCOPE);     
    //jsp page
    NamingEnumeration results = (NamingEnumeration)renderRequest.getPortletSession().getAttribute("person");
    <% if(results != null){
          while(results.hasMore()){
            SearchResult sr = (SearchResult)results.next();
            Attributes attributes = sr.getAttributes();
            String fullName = attributes.get("fullName").toString();
            String description = attributes.get("description").toString();
            String title = attributes.get("title").toString();
            String mail = attributes.get("mail").toString();
            String eduPersonPrimaryAffiliation = attributes.get("eduPersonPrimaryAffiliation").toString();
            String telephoneNumber = attributes.get("telephoneNumber").toString();
            String postOfficeBox = attributes.get("postOfficeBox").toString();
            String[] Name = fullName.split(":");
            String[] Desc = description.split(":");
            String[] JobTitle = title.split(":");
            String[] Email = mail.split(":");
            String[] Class = eduPersonPrimaryAffiliation.split(":");
            String[] Phone = telephoneNumber.split(":");
            String[] BoxNo = postOfficeBox.split(":");
            %>
                //....................... Bunch of printing information here        
               }//end while
         }//end if
         else{%>
              <div>No results found.</div>
         <%}
          results.close();
    Can you not reference a result set from both of these locations?
    Thanks.

    Hi Gravy Train,
    I'm curious about why you are using 2 loops.   You mentioned one is for monitoring and one is for DAQ....what do you mean by that?   What is the overall goal of this piece of code.   Also, I noticed that you are not closing the task.   Since this is just a subset, I realize you could be closing it in your actual code, but just in case you're not.....it is very important that you close all tasks when you are down acquiring data.
    Best Regards,
    Starla T  

  • So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. Can someone help me?

    So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. I am getting quite annoyed because apples hours arent the best fitted to my scedule since I have school and work, so I cant call and ask how to get fixed. Please help me all I want to do is buy some music...

    Click here and fill out the form.
    (90729)

  • Can you invert a mask in photoshop elements 12?  if not, is there a "walk around" that would achieve the same result?

    I am taking a class about using textures...most folks are using photoshop....I don't want to tackle that and try to learn about textures..
    can you invert a mask in Elements 12...or is there another way to achieve the same result?
    thanks

    thanks..
    I am having trouble with the keyboard " If you’ve already added the mask, you can invert it by typing command/control + i while the mask is active for editing. "
    so maybe I will try again...would love to get it working!
    many thanks for your prompt reply

  • After upgradataion ,In testing phase- after search ,in result view we are getting some unwanted data ' +++++" should be added in Name .how to remove it.can you please help.

    Hi Team,
    After upgradataion ,In testing phase- after search ,in result view we are getting some unwanted data ' +++++" should be added in Name .how to remove it.can you please help.
    I want to remove ++++ in that column.

    Hi Kalpana,
    Please provide additional information for community users to relate this issue. Info like versions (old & new), the object which has this problem or component/view name will be useful to get the answers.
    Regards,
    Shobhit

  • I always update my iPad without any problem , but this time for the iOS 7 , it is still downloading from yesterday more than 24 hours and as a result I can't open any email . So can you help me or tell me what went wrong

    I always update my iPad without any problem , but this time it didn't work out . My iPad 4 is still downloading from yesterday and I can not meanwhile open any website or any mail . Can you tell me what went wrong ??

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • Can you get values back from a stored procedure via OUTPUT parameters?

    Can you get values back from calling a stored procedure via OUTPUT parameters/variables? I call the SP via a SQL statement from a script either in a WF or DF.
    I thought I read some reference that DI could not get the values from OUTPUT parameters but I could not find it again (don't know if it is in any of the documentation or referred to in a forum.
    I did try a couple of tests but it did not reutrn any values via OUTPUT. But before I give up I thought I'd see if you could and maybe I needed to change something.

    This isn't exactly an answer to your question, but I'll point out that, given that you're resorting to a SQL script in the first place, there's no reason you can't also turn the output parameters into a regular result or record set. (The following uses T-SQL, although I think it's pretty generic.)
    declare @param1 int, param2 varchar(100), @return int;
    exec @return = proc @param1 = @param1 output, @param2 = @param2 output;
    select @param1 as param1, @param2 as param2;
    That is, to get from output parameters to a "regular" output from the SQL script isn't much of a leap...
    Jeff Prenevost
    BI Consultant
    Ann Arbor, MI

  • Yesterday, as today's deadline for filing tax returns approached, I was paralyzed by the inability to create new IRS PDF forms and to retrieve archived ones from a year ago. My computer went crazy. 24 hours later, I am still paralyzed. Can you help?

    My computer went crazy yesterday on two occasions involving PDF documents. One dealt with attachments to an email from a bona fide corporation. The other dealt with IRS PDF forms & schedules needed for today's submission.
    As both dealt with PDF and had nothing else in common, I suspected my PC had a virus. When I asked a local store technician, he agreed. I turned to Norton, which protects my PC from viruses, and after a few hours of really thorough searching, the computer was found to have no viruses.
    Before describing what I call "crazy" computer behavior, you need to know that I have long had IE8 as my default browser but a few weeks ago switched to Mozilla Firefox because IE8 had beome incompatible with some websites from which I get information.
    When I received the email from AT&T email service and clicked the first of four icons representing attachments, there was figuratively an explosion on my monitor: a series of new tabs, each called New Tab, burst onto the monitor--but no text or picture. The new tabs appeared faster than I coul kill them. I finally decided just to shut down the computer, hoping they would not reappear when I restarted. I was wrong. After 2 repeats, I decided to forget about the attachments and asked the sender to send them to me by regular mail.
    That was no solution for my IRS PDFs. I wanted to complete filling in the various forms and schedules that I had begun months ago so that I could mail them today to the IRS (without having to copy them all in ink). When I tried to open the first one, BOOM. The same thing happened: the blizzard of New Tabs atop blank pages; my IRS form or schedule did not show up. Did the same shutdown/restart routine with the same results.
    When I looked at the list of current forms that had to be completed, I noticed something very strange: the icons that began the listing of the documents' names were replaced one by one by Mozilla icons. When I moused over them, they said Firefox HTML. Why?
    Starting the day today, I had the same experience. What's more, when I started to retrieve 2012 IRS PDFs from a year ago, the same New Tab tabs appeared and had to be killed, and Mozilla icons replaced whatever icon was there before.
    Assuming that the problem arose with Adobe Reader's reading of the PDFs, I contacted Adobe but got no helpful phone number because PDFs are a free service and was directed to use this Forum to get help.
    What do I have to do to (a) read and use PDFs in the normal way and (b) remove the Mozilla icon from those that have appeared on icon documents. If Mozilla is the source of the problem, shall I go back to IE8? (In my 80s, I want eventually to replace my old computer but for the time being I must continue using it. It will not take an IE9. Anther possible default browser would be Google Chrome, but I have unfavorable impressions of it because of its intrusiveness, loading my PC with stuff I do not need.
    Can you help?

    The problem is absolutely not Reader. The problem is that FireFox has stepped in front of Reader and handles all the PDF stuff - wrongly in your case. FireFox is DESIGNED to take over PDF files. But it is not capable of doing IRS forms!
    To start with go back to IE for these forms. When you save them to disk DO NOT DOUBLE CLICK ON THEM until this is fixed. Just open the in the normal way - start Adobe Reader and use Open from the File menu.

  • HT4847 can you share icloud storage space with a family member?

    I used to have MobileMe family, and my wife and I are now both receiving alerts that we are running out of icloud space. Can you buy a shared icloud plan?
    Thanks

    If you are both using the same Apple ID, then you can share the iCloud storage that you have. However sharing an Apple ID for iCloud is not really recommended, it results in confusion over contacts, calendar, notes etc etc.

  • Can you please take a look at my TM Buddy log and opine on what the problem is?

    Pondini,
    Can you please take a look at my TM Buddy log and opine on what the problem is?  I'm stuck in the "Preparing Backup" phase for what must be hours now.  My last successful backup was this morning at 7:16 am.  I did do a series of Software Update this morning, one of which, a security update I believe, required a restart.
    I'm confused as to what the issue is, and how to get everything back to "it just works".
    Many thanks in advance.
    Starting standard backup
    Backing up to: /Volumes/JDub's Drop Zone/Backups.backupdb
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Event store UUIDs don't match for volume: Area 420
    Event store UUIDs don't match for volume: Macintosh HD
    Error: (5) getxattr for key:com.apple.backupd.SnapshotSt

    Time Machine can't read some data it needs from your backups (each of those date-stamps is one of your backups). 
    That's usually a problem with the drive itself, but could be the directory on it. First be sure all plugs are snug and secure, then see if you can repair it, per #A5 in Time Machine - Troubleshooting. 
    If that doesn't help, post back with the results.  Also either tell us what kind of Mac you have, what version of OSX you're running, or post that to your Profile, so it's accessible.  
    This is unrelated to the original post here, so I'm going to ask the Hosts to split it off into a new thread.  Since you've posted in the Lion forum, I'll assume that's what you're running.  You should get a notice from them

  • Can you put on songs in queue from your PC (windows) to play from another device?

    You might have stumbled upon my other topic about queue problems with my PS4, i got a response from Spotify support that didnt help much, so i tried experimenting a little. Instead of just trying to play from the ps4, i tried playing through my phone using connect. The queue-system totally messes up when trying to queue from windows, anyone else have this problem? I have actually tried with 2 laptops now. with the same result, so now i want to know what your experience is :) Can you try this out to help me? I want to know if this is ... just how it works or if its just a problem for me-------------------------------------------------------------------------------------- I gave the support guy an example on how things work, you dont have to read this to answer the question above, but it might enlighten my issue a bit more? =)----------------------------------------------------------------------------------------------- As you can see by the description of the problem, i know how the connect feature works. And i know how to queue songs. I can queue songs from my mobile (sony xperia z3) when using the connect feature. I can queue songs on the ps4 app and it works without any problems. Ill give you an example.
    Example is that i play from my ps4, the pc and the phone are connected with the connect feature
    - I put on a song using my pc --> the spotify app on the ps4 starts playing music- I put a song in queue from my phone- I put a song in queue using my ps4 controller (at this point, the two songs i put on queue shows correctly up in the queue menu on spotify on PC)- I skip to next song - queue works correctly, the next song plays. I skip again and the third song plays, no problems, it works fine!- I now do the same, i put on the same two songs in queue, using my phone and my controller.- I put one song in queue from my pc (suddenly the previous songs i skipped also shows up (duplicates, since the songs i put on the other time are there too)- I press next song --- now the songs in queue are just skipped. They are still in queue, but they will not be played. The song beneath the queue list will be played instead
    This is just an example. I can disconnect my phone from connect and only use my PC and the queue problems are still there, so im guessing its some problem with the app or some setting on my PC.

    This is the forum for Feedback about Discussions. Try one of these forums:
    iPod
    iTunes for Windows

  • Can you customize what folder MAIL goes to when adding attachments?

    Can you customize what folder MAIL goes to when adding attachments?
    My friend has 2 email addresses for businesses.
    He has invoices in folders for both, and wants to set up the Mac like this:
    When he writes from one email address and attaches documents - he want the Mac always to go to the corresponding folder for that company of his. Same for the other email address...
    Make sense?
    Can this be done?
    Thanks in advance....

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether your problem is caused by third-party system modifications that load automatically at startup or login. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click  Log in.
    *Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.  The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

Maybe you are looking for

  • Configuring SMTP Namespace Sharing between two Exchange Forests on the same LAN

    Hi guys, really hoping that someone can help me with configuring SMTP Namespace Sharing between two Exchange Forests on the same LAN. Basically, I have created a new forest and installed a new exchange organisation in this forest.  Both forests are l

  • Automator - Filter Finder Items filtering contents of sub folders

    I have an external hard drive and I want to keep my iTunes music library automatically backed up on it. I am using automator to copy my most recent files to the external (run the script once a week). I let iTunes manage all my audio files, etc so I f

  • Need function modul for role

    Hi All! Do you know whether there is "function modul" existing wherby I can find out Persons role by giving his name or ID ? Thanks sas

  • Using HR_INFOTYPE_OPERATION dont call user exit

    Hi , I need to write BAPI that create entry in infotype . I am using FM "HR_INFOTYPE_OPERATION" ... This FM don't call the user exit EXIT_SAPFP50M_002 .... Am i using the FM correctly ? How can i use the FM with the user-exit . Thanks .

  • Customize autocomplete filter of DropDown

    Hi there, I'm currently working on a more complex autocomplete solution for a dropdown list. It's described in several sources that by enabling the "custom text entry" of the dropdown list, open it up on enter and do some filtering on exit, you have