How to sort data in descending order when user clicks on the column heading

Hi
I have a report called "Top customers", which shows the top customers for a specific product line. It displays the customer name and one column with the total amount spent in the period for each product line. By default, the leftmost product line is sorted in descending order.
If the user wants to know who are the top customers for another product line, they simply click on the column heading to sort the list by that column.
The problem is that when you click for the first time on a sortable column heading, Apex sorts it in ascending order; you need to click on the same column heading again to sort in descending order.
Is it possible to change this behaviour and sort the data in descending order in the first click? So the users don't have to click twice...
Thanks
Luis
PS: Apex 3 running on Oracle 10.2.0

Luis,
See: Can I "catch" a click on a sortable column header of a report?
Take a look at Anton Nielsen's answer with regards to hiding a column and displaying its value instead of the sortable column.
Asumming the following simple report query:
select product,sales
from <table>
Change that into:
select product
,sales*-1 as reverse_sales -- Select this one as an extra column
,sales -- Hide this column
from <table>
In your report column attributes (of column reverse_sales), html-expression, type #sales#. It then displays the normal sales. However apex will generate a 'order by 2 asc' for the first time. The '2' will refer to the sales*-1 value: sorting it asc, is the same as sorting sales descending...
Toon

Similar Messages

  • How to retrieve Data in a JTable, When you click on the specified line?

    I Have a JTable. When I click on a line, I want to retrieve the value of the last column of the selected line.
    I do that:
    int selectedRow = lsm.getMinSelectionIndex();
    int selecRow = lsm.getMaxSelectionIndex();
    String res="";
    if (selectedRow == selecRow)
    System.out.println("number of colomns="+nbCol);
    indiceDoc=(String)(data[selectedRow][1]);
    res = " Row "+selectedRow + " selected"+"Indice =:"+indiceDoc;
    else res = " Rows "+selectedRow + " to "+selecRow + " selected";
    When the table is not sorted, it's ok, but when I sort one or more colomns, it don't return the correct value. It returns the value of an other line.
    "Data" is my original table, but I think that it don't change when sorting.There is the Problem I thinK.
    I think its because the index of the lines is reinitialize after each sorting.
    Do you have an Idea?

    The problem seems to be the sorter. You will have to ask the sorter for the sorted row number.
    I have modified my TableSorter with a new method:
    public int getJTableRowToModelRow(int index) {
         return indexes[index];
    So in my class which holds the tablemodel, table & sorter if I want to get hold of an row I write:
    int selectedRow = table.getSelectedRow();
    int sorterRow = sorter.getJTableRowToModelRow(selectedRow);
    Object data = tableModel.getData(sorterRow);
    tableModel.getData(int row) is an added method to the tablemodel. It only, in your case, returns data[row][1];
    I hope this wasn't to messy for you... ;-)
    //David

  • How do I sort songs in the iTunes store?  You used to be able to click on the column header to sort the column (ie Popularity)?

    How do I sort songs in the iTunes store?  You used to be able to click on the column header to sort the column (ie Popularity)?

    It seems this is a "backwards" upgrade from Apple in their iTunes 11 release....like you, I used to use that function in the iTunes store to sort through and decide which song version to purchase.   (For a large returned list of songs...see all...then sort by any of the headers, including Popularity...this functionality is now gone.)  
    The iPad always suffered from this...was never able to sort on those same column headers with an iPad.   It seems, this new iTunes release killed that functionality on the Mac as well.
    Just one of the few things that went wrong with number 11!
    Better luck next time,

  • How do I access recorded meetings? when I click on the 'meetings' tab it says I don't have permission

    how do I access recorded meetings? when I click on the 'meetings' tab it says I don't have permission

    Meeting recordings will have a direct URL, just like meeting rooms and content within Connect. You likely not a member of the Meeting Host group or Admin group within that Connect account, so you don't have the permissions to access the Meeting Library.
    You will either need the Host of the meeting room that you are looking for the recording of to get you the link, and insure you have the correct permissions to view it, or have them move the recording to the Content Library where it can be placed in a folder that you have permissions to view.

  • Sort by clicking on the column heade with LIFO

    Good morning!
    I would like to sort by last entry is first (LIFO) in my report.
    To do that, I have to un check in sort:
    Home>Application Builder>Application ***>Page 1>Report Attributes*(Otherwise APEX shows: "Your query can't include an "ORDER BY" clause when having column heading sorting enabled.")*
    When I follow the APEX suggestion, my report lost feature to sort by clicking on the column header.
    I still want to keep sorting ability on any column just by clicking on the column header.
    Thanks in advance,
    Sam

    Sam,
    First remove the order by clause from your query and then try to set the sorting using the sort sequence. Thanks.
    Regards,
    --Manish                                                                                                                                                                                                                                                                                               

  • Is it possible to display an Alert when user clicks on the X on the browser

    Hi
    Is it possible to display an Alert when user clicks on the X on the browser.I saw some threads regarding this mentioning about js.I want to do this ins the iProcurement module and dont wnat to make changes to each and every page.
    isn't there any global setup which would help to achive this?

    Are you talking about Windows close X. If yes, then to my knowledge there is nothing in OA Framework to handle it. You can check if it can be handled using javascripts.

  • Why can't I view my bookmark folders in alphabetical order when I click on the bookmark button on the browser? Is there a way to see the folders in alphabetical order all the time?

    I click on the bookmarks button on the Firefox browser and the folders that hold the bookmarks are not in any particular order. I would like the folders to be in alphabetical order when I see them...when I click on the bookmarks button at the top of the browser. When I go to organize bookmarks I can sort them so they are in alphabetical order, but they do not show up that way when you just click on the bookmark button to get to your bookmarks. Any help would be greatly appreciated! Thank you!!

    http://kb.mozillazine.org/Sorting_bookmarks_alphabetically

  • How to save data in html format while user click a save button in jsp page

    Hi All,
    I have the following requirement
    If user click on the Save Button it should display a window which allows the user to select the directory and the data is stored in the Internet Explorer Format.
    Could please anybody suggest me how to impletment the above requirment in jsp page.
    It's very urgent. Please replay ASAP.
    Thanks
    Rajeshwari

    Analyzing ur ques ...
    If user click on the Save Button it should display a window which allows the user to select the directory and the data is stored in the Internet Explorer Format.hmmm..
    There is no html object type which supports directory selection for download. There is only an input type="file" which however is related to an upload scenario.
    By downloading the file using output stream u can achieve what you want.
    You simply need to do the following things ..
    a) Write to an output stream
    b) Set the content type to "text/html" for your response
    Example ....
    response.setContentType("text/html");
    response.setHeader("Content-disposition",
    "attachment; filename" +
    "Example.html" );
    javax.servlet.ServletOutputStream stream = res.getOutputStream();
    StringBuffer text = new StringBuffer(1024);
    text.append("some text . . . ");
    text.append("more text . . . ");
    stream.write(data);
    stream.close();

  • When user clicks on the link ,it will display some record based on value

    Hi
    i want to create such a query/request in the Dashbord,when user click on it, it will open the other request in the same place based on the value it clicks.
    More detail idea about the question:
    for ex. i have created one query, which gives the following output.
    current_loan_amount Current_status
    now when user click the current_loan_amout ..........the detail page will be displayed.
    wchich will give the dettail about the Current_loan_amount.....like to whom the loan has been given,region,address,broker name etc..
    So if anybody knows anything about this.
    Guide me

    Yes you can create a navigate report where it displays the details for the amount user selected.
    You can enable navigation on the metric(column format-interation-navigate) and give the path of the other qyery.
    You just need to pass all the values that you need using "Is prompted" Filters.
    Hope it helps
    Prash

  • How to show the data in table format when user click the Graph

    Hi,
    I have a graph in my report. If user click the graph is there a way to show
    the data behind it?
    Thanks.
    Regards,
    Jun

    Hi All,
    Any idea how to do this?
    Thanks.
    Jun

  • How to open a new IE page when user clicks on a button or link

    Hi Experts,
    I have created WD program which fetches data from R/3.
    I have to create a link or button on the WD program. When the user will click on the link, another IE page should open. Some processing will be carried out by WD. The result of WD processing should be displayed in this new IE page.
    Regards,
    Gary

    Hi Gary,
    You need to create a seperate window and embed a new view in it. and yeah for accessing that window you need to create one apllication also which is connected to this window.
    Then in the event handler of the button's click action write the follwing code:-
    String deployableObjectName =
                   wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
    try {
                   // Get deployable object part of target application.
                   // Precondition: assume, that other application belongs to the same
                   // Web Dynpro Project (Deployable Object)
                   WDDeployableObjectPart deployableObjectPart =
                        WDDeployableObject.getDeployableObjectPart(
                             deployableObjectName,
                             <window name>,
                             WDDeployableObjectPartType.APPLICATION);
                   urlToTargetApp =
                        WDURLGenerator.getWorkloadBalancedApplicationURL(
                             deployableObjectPart,
                             UrlParam);
              } catch (WDURLException e) {
              } catch (WDDeploymentException e) {
                              IWDWindow win1 =  wdComponentAPI.getWindowManager().createNonModalExternalWindow(urlToTargetApp,"Ouput");
    win1.show();
    This will open a new window and then in the wddoinit of the new window's view you can execute the bapi and display the content accordingly.
    Regards,
    sarbjeet Singh

  • Issue of data getting wiped out when user clicks on back button..

    Hello Gurus,
    I have a selection program which displays ALV on execution. Now I have programmed the "Back" Button of standard toolbar so that when comeone clicks on it, it should leave to selection screen.
    WHEN 'TBACK'.
          LEAVE TO TRANSACTION SY-TCODE.
    But when I do that, the values entered by user during execution of selection screen wipes out and all the selection fields become empty. How can I make sure that when sure clicks on 'Back' button, the selectiuon screen is presented but with values in which user put during execution.
    Regards,
    Rajesh.

    Hi Rajesh ,
    Leave to transaction sy-tcode is as as good as call transaction...so basically using this statement will start the transaction afresh..and give a new selection screen....
    Better option would be to leave to screen 0 (preferaby used for a report )which will take you back to the previous screen processed or leave to screen XXXX for a particular screen( in case of a module pool )
    Hope it helps
    Regards
    Byju

  • How can I prevent forms from being prematurely submitted when users click on the  "Enter" key?

    Is there any way that I can prevent Dreamweaver CF submission forms from being prematurely submitted by the user when he/she clicks on the "Enter" key before they have completed the form?  I need the users to finish form and click on the "Submit" key.  I have the "Submit" key action configured as "submit form"

    Thank you!
    Found a solution through Google.

  • By default first tab should open, when user clicks on the Open popup.

    Hi Team,
    I am working on Jdev11g.
    I am facing problem to Open Fisrt tab from popup when i revisite to it irrespective of the Tab which was earlier selected while closing the popup.
    Currently i am populating one list for records in ADF table and in fisrt column i am providing commandImageLink to open popup which contains 5 different tabs.
    when i select first record from table and click to open popup it's working fine .If i select any tab apart from first tab and i close the popup it is getting closed properly.
    But when i revisite that popup it shows me the popup with default Tab opened which i was earlier selected when i checkout from that popup.
    I want Open Fisrt tab from popup when i revisite to it irrespective of the Tab which was earlier selected while closing the popup.
    Thanks
    Jaydeep

    Luis,
    See: Can I "catch" a click on a sortable column header of a report?
    Take a look at Anton Nielsen's answer with regards to hiding a column and displaying its value instead of the sortable column.
    Asumming the following simple report query:
    select product,sales
    from <table>
    Change that into:
    select product
    ,sales*-1 as reverse_sales -- Select this one as an extra column
    ,sales -- Hide this column
    from <table>
    In your report column attributes (of column reverse_sales), html-expression, type #sales#. It then displays the normal sales. However apex will generate a 'order by 2 asc' for the first time. The '2' will refer to the sales*-1 value: sorting it asc, is the same as sorting sales descending...
    Toon

  • JMenu fails to disappear when user clicks outside the JMenu................

    I have implemented a JMenu within a JMenuBar everything runs fine. However, with this application and with all others I have seen when you click a JMenu leaving it open and then click anywhere on the title in Windows the JMenu remains open. Windows native programs dont do this and it is just a nuisance for a user to go and disable the JMenu by clicking it again.
    Does anyone have a solution for this.

    As this new feature works... say you have a JInternalFrame you want to be "modal" well cause they are lightweight, that is inpossible. SO now you can set a JDialog to unDecordated() and implement the JInternalFrame paint methods, and produce a "JInternalFrame" that is "modal" (just an example) i just the "setUndecorated(false);" in my JXcalendar popup, it works bette rthan JWindow, cause it listens for all window events.
    Hi Johannes,
    I checked this and it did not work. Then I read the
    bug evaluation (should have done this before): JAVA
    doesn't get any event from the title bar. The
    workaround is provided in 1.4 with
    "non-decorated window frames and the ability to add
    user defined window decorations".
    I don't know this stuff. Is there anybody who already
    has got experience with these new features?

Maybe you are looking for

  • Problem with ora:countNodes...

    Hi i am trying to poll database and receive the records using receive activity. later i am trying to count the number of record polled each time. i am using ora:countNodes function. But i am getting the below error : Error while processing xpath expr

  • Reinstallation of Photoshop 10 in my Imac with Mavericks OSX creates error code 213:5

    I reformatted my hard drive and reinstalled all of my software. However when I install Photoshop Elements 10 and attempt to boot the program I get an error message of ,"Error_213:5".  I have read Permission fixes about the PCD folder and applied  "Ap

  • Email Script only using Flash. Not Using Asp,Php

    Hi, Thanks in Advance. Hi i want the script mailing directly from flash(swf ) to the id where we mention not using any php,asp only using Screenweaver Third Party Plugin Any Idea on this ISSue. AnyOne Can Help Kindly. Awaiting For your reply mail. R.

  • Problem in event handling using oo abap code

    Hi, My requirement is i need to disply 3 blocks in ALV format.I have done that.Now my problem is if i double click on aufnr of the first block, it should call the transaction code. I have written the code in oo abap but i have used function modules f

  • Is Soundbooth integration really supposed to be this hard?

    I love the way dynamic link works with PPro and AE and Encore, but I am hoping that I am just missing something with what seems to be very poor integration with SoundBooth. If someone would please educate me on the most efficient workflow of working