Not sorting ??

SELECT  XMLAGG(
                        XMLELEMENT("SCHEDULEHISTORY",
                                   XMLFOREST(SCHEDULENAME,
                                             TO_CHAR(IMPORTSTARTTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') IMPORTSTARTTIME,
                                             TO_CHAR(IMPORTENDTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') IMPORTENDTIME,
                                             TO_CHAR(READINGSSTARTTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') READINGSSTARTTIME,
                                             TO_CHAR(READINGSENDTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') READINGENDTIME,
                                             NUMOFMETERSIMPORTED, STATUS
                      ).GETCLOBVAL()
         FROM  ( SELECT SCHEDULENAME, IMPORTSTARTTIME, IMPORTENDTIME, READINGSSTARTTIME, READINGSENDTIME, NUMOFMETERSIMPORTED, STATUS, ROWNUM RN
                 FROM   (
                          SELECT SCHEDULENAME, IMPORTSTARTTIME, IMPORTENDTIME, READINGSSTARTTIME, READINGSENDTIME, NUMOFMETERSIMPORTED, STATUS
                          FROM   DATAIMPORTHISTORY ';
                          /*ORDER BY DECODE(cp_sortDir, 'A',
                                                             DECODE(cp_sortBy, 'SN', SCHEDULENAME,
                                                                               'IST', IMPORTSTARTTIME,
                                                                               'IET', IMPORTENDTIME,
                                                                               'RST', READINGSSTARTTIME,
                                                                               'RET', READINGSENDTIME,
                                                                               'NMI', NUMOFMETERSIMPORTED,
                                                                               SCHEDULENAME
                                      DECODE(cp_sortDir, 'D',
                                                             DECODE(cp_sortBy, 'SN', SCHEDULENAME,
                                                                               'IST', IMPORTSTARTTIME,
                                                                               'IET', IMPORTENDTIME,
                                                                               'RST', READINGSSTARTTIME,
                                                                               'RET', READINGSENDTIME,
                                                                               'NMI', NUMOFMETERSIMPORTED,
                                                                               SCHEDULENAME
                                            ) DESC
                 WHERE ROWNUM < ((cp_pageNumber * cp_pageSize) + 1)
         WHERE  RN >= (((cp_pageNumber-1) * cp_pageSize) + 1)*/This is my select stmt in xml formate,
at front end application the sorting is now working.
When i am executing at backend its working, and executing in .net application its working, when i am deploying at clientside
its not sorting...??
here Databases we areusing
Oracle 10g .2 v,
.net 3.5

I don't think your rownum is going to work based on the order defined in a inner query
I would do this:
SELECT  XMLAGG(
                        XMLELEMENT("SCHEDULEHISTORY",
                                   XMLFOREST(SCHEDULENAME,
                                             TO_CHAR(IMPORTSTARTTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') IMPORTSTARTTIME,
                                             TO_CHAR(IMPORTENDTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') IMPORTENDTIME,
                                             TO_CHAR(READINGSSTARTTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') READINGSSTARTTIME,
                                             TO_CHAR(READINGSENDTIME, ''MM/DD/YYYY HH24:MI:SS.FF6'') READINGENDTIME,
                                             NUMOFMETERSIMPORTED, STATUS
                      ).GETCLOBVAL()
         FROM  ( SELECT SCHEDULENAME, IMPORTSTARTTIME, IMPORTENDTIME, READINGSSTARTTIME, READINGSENDTIME, NUMOFMETERSIMPORTED, STATUS, ROWNUM RN
                 FROM   (
                          SELECT rownum as row_number,SCHEDULENAME, IMPORTSTARTTIME, IMPORTENDTIME, READINGSSTARTTIME, READINGSENDTIME, NUMOFMETERSIMPORTED, STATUS
                          FROM   DATAIMPORTHISTORY ';
                          ORDER BY DECODE(cp_sortDir, 'A',
                                                             DECODE(cp_sortBy, 'SN', SCHEDULENAME,
                                                                               'IST', IMPORTSTARTTIME,
                                                                               'IET', IMPORTENDTIME,
                                                                               'RST', READINGSSTARTTIME,
                                                                               'RET', READINGSENDTIME,
                                                                               'NMI', NUMOFMETERSIMPORTED,
                                                                               SCHEDULENAME
                                      DECODE(cp_sortDir, 'D',
                                                             DECODE(cp_sortBy, 'SN', SCHEDULENAME,
                                                                               'IST', IMPORTSTARTTIME,
                                                                               'IET', IMPORTENDTIME,
                                                                               'RST', READINGSSTARTTIME,
                                                                               'RET', READINGSENDTIME,
                                                                               'NMI', NUMOFMETERSIMPORTED,
                                                                               SCHEDULENAME
                                            ) DESC
                 WHERE row_number < ((cp_pageNumber * cp_pageSize) + 1)
         WHERE  RN >= (((cp_pageNumber-1) * cp_pageSize) + 1)Assuming that your commented order by isn't working

Similar Messages

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

  • Creative ZEN, Albums fused, does not sort albums correctly!

    ;Creative ZEN, Albums fused, does not sort albums correctly! http://nl.creative.com/products/prod...t=6999&listby=
    Creative ZEN, Albums fused, does not sort albums correctly!
    I attach my Creative Zen to my computer true USB,
    I manually copy Albums to my creative zen.
    If i view my (ZEN) folder in Windows XP, everything looks great and sorted!
    I safely remove my ZEN player from my computer,.
    The ZEN rebuilds his data.
    I go and view albums, and what do i see each time! over and over again!
    Albums fused together, albums scattered true each other, MOST albums got different names then in windows XP!
    I get really frustrated from this! how can i make this right!
    I want the ZEN to show the albums like in WINDOWS XP! how hard can this be!!!
    Thanks for the help in advance!
    Greetz!
    Support4u

    Hi,
    The Creative ZEN organizes songs according to the ID3tag of the music file, not by folders. If you want to arrange the music files in the order you want, please check and make sure that the music files are tagged properly. You may need a third-party tag editor to do this.

  • Some photos are not sorted correctly by date

    I just imported some photos from my friends camera who were on the same trip. However, I noticed that a couple (not all) of his photos are not sorted correctly by date in the Event. A photo from day 3 somehow comes before the photos from day 2. I checked the extended information and the dates on the photo are correct. Has anyone had this problem and know of a solution? Thanks.

    It might be of some help to delete the photo cache. Please see this link - http://support.apple.com/kb/TS1314

  • Outlook Contacts do not sort correctly under iCloud

    I have recently started mucking around with iCloud (after the unfortunate discontinuation of MobileMe...).
    I use MS Outlook 2007 on my PC (Windows 7 64-bit) for my Contacts, Calendar & Tasks.  Untill recently, I was syncing my Outlook Contacts & Calendar with my iPhone (latest iOS) via iTunes.  All was working fine.
    A couple of days ago, I installed the iCloud Control Panel on my PC and gave it a go to see what will happen to my Outlook setup.  I enabled just the Contacts in order not to stray out too far...
    Once done, iCloud took all the contacts from my personal folder in Outlook and moved them to a new iCloud folder.  So now, I have two different Contact folder, the iCloud dedicated one (which is fully populated) and the other one is the one previously used (which is stored in my local .pst file and now empty).
    All syncing to the iCloud seems to be working OK - I checked my contacts from the www.icloud.com and they are all there.
    The problem I have is withing the new iCloud Contact folder that was created in my Outlook installation.  It does not sort my Contacts correctly
    I have contacts written both in English and in Greek, depending on where they reside.  It seems to get mixed up because of this and mixes up the Greek contacts inbetween the English ones, in a manner that I cannot justify.
    Previously when I had all the Contacts in my local .pst file, it was showing the English ones first and then all the Greek ones, both sorted 100% correctly (by the way, this is how it looks as well in my iPhone).  I have also enabled an option in Outlook settings which allows me to create a second index for the Contacts in Greek - this creates a second Greek alphabet next to the already existing English one on the right of the Contacts view.  None of that seems to have an effect in the case of the iCloud Contacts folder in Outlook, which doesn't sort as it should.
    Has anyone come across this issue and is able to offer some assistance?
    Regards.

    No none, the contacts just do not sort in alphabetical order they should be in. For example I added a name that started with an S but it would not go under the S category of names but rather it would create a new S group at the top of the contact list before the contacts starting in A. The OLD list of names starting with S is still existing and in the right alphabetical order but the new contact would not save under that group but rather as I said in a new group starting with S at the top of the contact list.

  • HT4221 Lightroom 3 Win 7- iPad 3 iOS 5.1.1 - images are not sorted by file name in albums

    photos are not sorted properly. thougts? suggestions?
    20050518 - 18.12.05 - 0001.jpg
    20050518 - 18.52.24 - 0002.jpg

    I found that mobile data stopped working on my iPad once upgraded to IOS 5.1. I have resolved the problem by re-applying the settings in Settings > Cellular Data > APN Settings which had (very bizarrely) been over-written as a result of the upgrade process.
    Clearly your APN settings will be specific to your data plan, but if you contact your contract provider, they should be able to tell you what they are.
    Hope this helps.

  • Lightroom 5 will not sort images properly, either by file name or capture time.  How can I fix this issue?

    I am using Lightroom 5 with OSX 10.9.2 and the sorting feature is not working properly.  When I try to sort my library by file name or capture time, it does not sort properly.  The order of images is mixed and stays that way, even after reboot.  The file information is correct, the sorting is the only issue.  The library is approximately 6,000 images and I am also using a plug in with the Publishing Service feature.  Any help on how to fix this issue without losing my editing work done on the library would be appreciated.  Thanks! Dan

    Thanks! I'm trying to sort by capture time or file name, and neither sorts correctly.  file names 3450, 3451, etc. before files 0234, 0235, etc.  It makes no sense.  Same with capture time.  Times are accurate in meta data, but sorting is just wrong.  I'm using a ShootProof plug in that is only used for uploading files to the web. The issue is in the main library folder, so I'm not sure the plugin has anything to do with it.  Any sort I seem to choose: capture time ascending order, file name descending order, whatever, yields a different yet inaccurate sort.  The below sort is flagged, by file name ascending order.  This is the bottom of the list where it goes from file brigitte_terry_w6408... to brigitte_terry_film_0039... to brigitte_terry_w2825...  Regardless of the 'film' file, the w2825... files should be displayed above w6408.  Thanks for any help!

  • When I sort bookmarks in "organize bookmarks" they are not sorted under the bookmarks pulldown menu. Latest additions are not integrated into the sort

    When I sort bookmarks in "Organize Bookmarks" they are not sorted under the pulldown menu on a regular page. Recently added bookmarks are not inegrated into to sorting.

    See this:
    [https://support.mozilla.com/en-US/kb/Sorting+bookmarks#Sorting_by_name]

  • Why is my Numbers spreadsheet not sorting properly?

    I am working with a sheet and want to sort the sheet alphabetically by a column that is formated as text.  It is not sorting properly.  What am I missing?

    It is a column of words which are names of catagories of medicines.  When I sort the list alphabetically, part of this list seems to sort correctly and then the rest is unsorted.  The column that I am sorting on is labeled. 
    ACETAMINOPHEN
    500mg
    100 TABLET
         ANALGESIC
    10
    06/01/2015
    ACETAMINOPHEN CHILDREN'S
    160MG/5ML
    4 OZ BOTTLE
         ANALGESIC
    5
    06/01/2015
    ACETAMINOPHEN/ INFANT W/DROPPER
    80MG
    30ML BOTTLE
         ANALGESIC
    20
    04/01/2014
    ASPIRIN
    325MG
    24 TABS
         ANALGESIC
    10
    Aspirin
    325MG
    500 tabs
         ANALGESIC
    1
    4/30/14
    Aspirin 81mg, Major Brand, Enteric Coated
    81mg
    250 tabs
         ANALGESIC
    10
    1/31/14
    IBUPROFEN
    200 mg
    160 CAPS
         ANALGESIC
    4
    Clotrimazole Anti-Fungal Cream
    1%
    28 to 30 GRAM TUBE
         ANTI-FUNGAL
    10
    6/30/15
    CLOTRIMAZOLE SOL
    1%/30ml
         ANTI-FUNGAL
    15
    06/01/2013
    FLUCONAZOLE
    100MG
    30 BTL
         ANTI-FUNGAL
    1
    04/01/2014
    MICONAZOLE NITRATE
    2%
    28 to 30 GRAM TUBE
         ANTI-FUNGAL
    10
    05/01/2014
    AMOXICILLIN CAP
    500mg
    50 caps
         ANTIBIOTICS
    10
    05/01/2013
    AMOXICILLIN POWDER FOR ORAL SUSPENSION
    125/5ML
    100ML BOTTLE
         ANTIBIOTICS
    15
    12/01/2013
    Amoxicillin Powder for Oral Suspension
    125mg/5ml
    80 ml bottle
         ANTIBIOTICS
    10
    11/30/14
    AMOXICILLIN/CLAVULANATE POTASSIUM PDR
    600mg/42/9mg/75ml
    75ML
         ANTIBIOTICS
    10
    02/28/2013
    AZITHROMYCIN TAB
    500mg
    9 tabs
         ANTIBIOTICS
    20
    08/01/2013
    CEFADROXIL CAP
    500mg
    50 caps
         ANTIBIOTICS
    2
    05/01/2013
    Cephalexin
    250mg
    500 cap
         ANTIBIOTICS
    1
    12/31/13
    Cephalexin For Oral Suspension
    125mg/5ML
    200ml bottle
         ANTIBIOTICS
    20
    9/30/13
    Cephalexin For Oral Suspension
    250mg/5ml
    100ML BOTTLE
         ANTIBIOTICS
    12
    5/31/15
    CIPROFLOXACIN TAB
    500mg
    100 tabs
         ANTIBIOTICS
    3
    06/01/2013
    CLINDAMYCIN HCL CAP
    300mg
    16 caps
         ANTIBIOTICS
    15
    05/01/2013
    DOXYCYCLINE HYCLATE TAB
    150mg
    100 tabs
         ANTIBIOTICS
    4
    09/01/2013
    GRISEOFULVIN
    125 MG
    4 OZ BOTTLE
         ANTIBIOTICS
    5
    06/01/2014
    METRONIDAZOLE TAB
    250mg
    250 tabs
         ANTIBIOTICS
    1
    01/31/2103
    SULFAMETH/TRI
    800/160MG
    500 BOTTLE
         ANTIBIOTICS
    1
    05/01/2015
    ALBENDAZOLE
    400 MG
    500 BOTTLE
         ANTITHELMATIC
    1
    01/01/2015
    DIPHENHYDRAMINE
    12.5MG/5ML
    1 PINT BOTTLE
         COLD/ALLERGY
    3
    04/01/2014
    DIPHENHYDRAMINE
    25 MG
    1000 BOTTLE
         COLD/ALLERGY
    1
    03/01/2015
    CIPROFLOXACIN OPTH
    0.30%
    5ML BOTTLE
         OPHTHALMIC
    4
    09/01/2013
    OFLOXACIN OPHTHALMIC
    0.30%
    5ML
         OPHTHALMIC
    5
    06/01/2014
    SILVER SULFADIAZINE
    1%
    85 GRAM TUBE
         TOPICAL ANTIBIOTIC
    2
    09/01/2014
    HYDROCORTISONE
    2.50%
    20 GRAMS TUBE
         TOPICAL CORTICOSTEROID
    5
    08/01/2015
    FOLIC ACID
    1MG
    1000 BOTTLE
         VITAMINS
    1
    06/01/2014
    VITAMINS - CALCIUM PLUS D3 GUMMIES
    60 BOTTLE
         VITAMINS
    12
    VITAMINS - MULTI ADULT SUPPLEMENT
    1000 BOTTLE
         VITAMINS
    2
    11/01/2013
    VITAMINS - MULTI ADULT/MINERALS
    150 BOTTLE
         VITAMINS
    8
    VITAMINS - MULTI CHILDRENS CHEWABLE
    1000 BOTTLE
         VITAMINS
    2
    10/01/2014
    VITAMINS - MULTI CHILDRENS CHEWABLE
    60 BOTTLE
         VITAMINS
    3
    VITAMINS - MULTI CHILDRENS GUMMIES
    60 BOTTLE
         VITAMINS
    24
    NAPROXEN SODIUM TAB
    550mg
    500 tabs
    anti-inflammatory
    3

  • IPad Video app not sorting correctly

    All,
    Long time reader, first time poster - but I cannot seem to find a resolution to my issue, I fail to see how this issue could go unresolved for as long as I have had it;
    The iPad video App when streaming from a home shared iTunes account does not sort TV shows as per the TV Show / Season / Episode attributes in the metadata. Is there a fix for this other than re-entering the metadata to the Artist attribute - I have a moderately sized library and this would consume my attention for far too long, not to mention its double handling!!!
    Surely the introduction of a sort function on iOS devices and Apple TV is not too much to expect.
    Thanks
    PGEELONG

    Actually there is a fix, that I found from another thread. Plug in yor device to the computer as it's faster. Un synch all your music from the iPad, which will remove it from the Pad. When that's done, turn the music synch back on, putting your tunes back on the device.
    The music library is corrupted and this will fix that. A regular synch will not work.

  • Smart playlist not sorted correctly on ipod

    I have a smart playlist in my iTunes 10.0, which contains all podcasts (with play count 0), sorted by release date.
    Unfortunately, this playlist is NOT sorted correctly on my ipod (nano, 5th generation). After syncing with itunes, the ipod playlist has some apparently random order (not by release date, not even by name, artist or anything, it really seems random).
    It's strange that, if I click on my ipod under "DEVICES" in itunes and click the playlist there, the correct order is shown (by release date). But again, on the ipod it is actually not sorted.
    Message was edited by: powerbookuser99

    I have a smart playlist for my podcast's and I normally sort them by the date added (oldest to newest) or by release date. No mater what I do now they only show up on my iPhone in date added order newest to oldest and I am unable to re-order them. I have a number of other playlists that work fine it is just this one smart playlist that is acting up. Any suggestions would be appreciated.

  • Synced photos from iTunes not sorted correctly

    I have around 300 pics that I took with my iphone that I moved to a local folder on PC.
    I want to put those pics back on the iphone to use in a timelapse video.
    I enabled Photo sync on itunes and chose that folder, and synced.
    All synced OK, but these pics are not sorted correctly on the iphone.
    The file names on the PC are exactly as iphone assigned them when taken, and according to date taken.
    It is very important that they are sorted in ascending file name; any ideas how I can correct the sorting?
    Thanks.

    For those in this discussion concerned with the "Sort" order, the criteria is in the "metadata" date that changes when you adjust the photos.
    The directions below apply to Lightroom
    To keep the order you created you must make an adjustment to "ALL" photos at the same time such as increasing the contrast by (1) point.
    First select and change the contrast in the first photo in your collection, then select the remaining photos, click "Sync" The "Metatdata" date will change on all photos selected and will then import in the prper order.
    I should mention that I have renamed all photos so they have a name that is sequential but I don't know if that matters

  • ITunes 9.1 not sorting artists correctly

    Just upgraded iTunes on Win7 PC to 9.1 and seem to have a problem with sorting on the Artist.
    I have a large (2800 CDs + various downloads) collection, with a lot of jazz - so quite a lot of music where the artist name is not a band name but a person's name. I always edit the Artist name so that it's Last name, First. The Album Artist that was added a while back was a nice help in this issue, but it seems to be causing problems with 9.1 I noticed after the upgrade that iTunes went through my library - and afterward, I suddenly had 150+ artists more than I did before. Charles, Ray had become 1) Charles, Ray 2) Ray Charles 3) Charles, Ray. (Yes, TWO entries with Charles, Ray.) Many other artists have similar issues and it seems to be taking the Album Artist and making duplicate entries for songs/records. When I removed the AA from the above, it collapsed back into 1 artist.
    Additionally though, I have noticed that there is even more than that wrong. For example, I have many John Coltrane records. All 66 of them are now showing up in the sorting order as "Coltrane, John" - but in the letter "A" next to Alice Coltrane. Similarly for a couple of Stevie Wonder songs - they now show properly as "Wonder, Stevie" in the list, but they're sorted in "S" as if it's "Stevie Wonder".
    This is really maddening. It looks to me like Apple messed up something here, and it's playing total havoc with the organization of my collection.

    Update - it looks like after quitting and restarting iTunes, the problem of not sorting alphabetically (Wonder, Stevie in S) is gone.
    However, it does appear to be sorting on Album Artist as primary key, instead of just Artist, and so far I can't find a way to change that.

  • Contacts do not sort correctly

    Whenever I add a new contact to my iPhone 4 S, the name goes to the top of my contact list and not where it should be in its alphabetical category, thus sorting of the contact list is not in alphabetical order. I did program it to list contacts by first and last name, I also reset the phone several times but to no avail. I even went to an apple store and no one knew how to solve the problem or why it was happening. Can anyone provide me some assistance in solving this problem ?
    Thank you in advance.

    No none, the contacts just do not sort in alphabetical order they should be in. For example I added a name that started with an S but it would not go under the S category of names but rather it would create a new S group at the top of the contact list before the contacts starting in A. The OLD list of names starting with S is still existing and in the right alphabetical order but the new contact would not save under that group but rather as I said in a new group starting with S at the top of the contact list.

  • My contacts will not sort properly on Macbook Pro

    Greetings all,
    I'm still trying to learn  the Mac OS, only been on it a couple months. Here is my issue, on the Macbook, my contacts will not sort by first name.
    On my iPhone and iPad, and when I log in to the iCloud and look at my contacts they are all sorted by First Name, and listed as (First Name, Last Name).
    When I go to the Macbook contacts they are sorting by Last Name... I have removed the contacts from my computer, unchecked the contacts rebooted, re-activated  the contacts on cloud and they still do not sort the way i want them too....
    Can anybody help me please.

    You helped me figure it out, I fill like a putz, I did not realize that the Contacts on the Mac OS, actually had its own settings.... I thought they were all controlled by the iCloud settings....
    I'm slowly but surely getting things figured out, after using Windows all my life.  Thanks a million.

  • ITunes 11 not sorting multi-disc audiobooks by disc number

    I just updated to iTunes 11, and for some reason, my multi-disc audiobooks are not being ordered by disc number in the Books view. Instead, it goes track 1 of disc 1, track 1 of disc 2, etc.
    The tracks have the disc numbers in their metadata, so why aren't they being sorted that way?
    This issue does not occur for music tracks, however. Puzzling, eh?
    Message was edited by: Jawshooah

    This worked perfectly for me. Thank you Giacomo!
    P.S. I also used PayPal to give DougScripts a $5 thank you.
    Giacomo Italy
    Re: iTunes 11 not sorting multi-disc audiobooks by disc number 
    Dec 10, 2012 2:17 AM (in response to Jawshooah)
    Guys, I have the ultimate solution!
    Use the following Applescript:
    Embed Disc Number in Track Number v1.0
    Applies selected tracks' disc number as hundreds digit in track number
    Short link: http://dougscripts.com/461
    date posted: July 14, 2009 - total downloads 926
    you can find it at:
    http://dougscripts.com/itunes/
    It is a reversible operation by definition!
    Cheers!

Maybe you are looking for