Selecting top row after sorting

hi,
i have a table emp, whose primary key is empid(varchar2),
i want to sort the empid and select the top row after sorting,
i can sort the table using "select * from emp order by empid desc,
i can select the top row using "select * from emp where rownum=1"
i want a combination of the 2,
pls provide me the required query
Thanks and Regards,
Saurabh Jhunjhunwala

SEELCT *
   FROM ( SELECT e.*
                           , ROWNUM  row_num
                   FROM emp e
                 ORDER BY empid desc
WHERE row_num =  1Regards
Arun

Similar Messages

  • Row selection messed up after sorting

    JDev version: 11.1.1.4 (but also reproducable in 11.1.2.1)
    See http://kpdwiki.be/Bart_L/tableIteratorSortSync.zip (open BO726.jws and run runThis.jspx)
    Situation:
    - iterator 'EmployeesIterator' which points to a view with Employees -> ChangeEventPolicy='none'
    - Bindings which all point to this iterator:
    - Tree binding 'Employees' used for an af:table with employees (firstname, lastname)
    - Attribute bindings 'FirstName' and 'LastName' which is used in a formLayout to show the currently selected employee
    - Operation Bindings to iterate through the employees (First, Previous, Next, Last)
    - runThis.jspx
    - formlayout with FirstName and LastName
    -> partialtriggers: Next-button and table (for the rest, no partialtriggers)
    - Next-button
    - table with employees
    Problem:
    1) if you select one of the employees in the table, and sort one of the columns, the first row will be selected. This is normal behaviour
    2)
    a) select the first row
    b) press the 'Next' button a few times. Now the selected employee in the iterator is 'X'
    c) in the table, select employee 'X' by clicking on its row
    d) sort one of the columns.
    Result: In the iterator, the first row of the table is selected, while the table selection shows something different!
    --> this is different behavior than the situation described in 1)
    --> after doing something with the table (sorting, filtering, selecting rows, ...), I would expect that the selected row in the table is always the same as the selected row in the iterator.
    Questions:
    1) Is this a bug?
    2) If yes, is this a known bug?
    3) If no: am I doing something which is not allowed? Or should I do something different here?

    I can reproduce the problem in 11.1.1.4.
    First employee is Steven King, which is selected. I then press next a few times till the output text reads Bruce Ernst (the table selection is still on Steven King, while the iterator points to Bruce Ernst). I then click on Bruce Ernst in the table, so it is selected (iterator stays on the same record). If I then sort the table, the table selection stays on Bruce Ernst, while the output text shows the first record in the table after the sort.
    We have the same issue using a non-modal popup to edit table rows (non-isolated task flow, sharing data controls & transaction). Our edit popup has navigation controls. When we scroll through records in the popup, the table selection doesnt refresh (changeEventPolicy = none). If we then select the record in the table that we scrolled to in the popup , without closing the popup, and then sort the table (with the popup still open), the selection stays on the previously selected record, whille the popup shows the first record in the table after the sort.

  • Showing selected row after sorting

    I have big JTable with lots of columns. Selection of row is highlighted
    using some background color. Sorting is also provided on TableHeader.
    After selecting some row, when user does the sorting, this selected row
    goes outof visible view of table.
    My requirement is to show the same selected row again after doing sorting. I was thinking of calling method like setSelectedRow(), but
    unfortunately there is nothing like this method.
    I was also thinking of using AccessibleJTable, but couldnt go
    anywhere.
    Is there any way to do this?
    Thanks in advance.
    Anup

    I have big JTable with lots of columns. Selection of row is highlighted
    using some background color. Sorting is also provided on TableHeader.
    After selecting some row, when user does the sorting, this selected row
    goes outof visible view of table.
    My requirement is to show the same selected row again after doing sorting. I was thinking of calling method like setSelectedRow(), but
    unfortunately there is nothing like this method.
    I was also thinking of using AccessibleJTable, but couldnt go
    anywhere.
    Is there any way to do this?
    Thanks in advance.
    Anup

  • ALV - Editing a Row after Sorting  - REAL HEADACHE.....

    Hi,
    I have a ALV table with a DropDown in one of the columns. The user can enter a value in the dropdown boxes.
    Now the proble is, lets say I have SORTED the table by another column. Now the user enters a value in one of the rows of the dropdown and clicks the SAVE Button.
    How do i find out, which Row the User Has entered the value ?
    I tried using the table it_modified_cells in the event handler for ON_DATA_CHECK . However it gives wrong row indexes, that is if, the row number '10' is Row number '1', after sorting, and if this row is modified, then it_modified_cells table gives Row '1' as modified rather than Row '10'.
    So ina  nut shell, after sorting , if a row is edited, How to find out which is this row...... ?

    Nithya,
    Look at this thread of mine....
    Re: ALV - Lead Selection of Node When FILTERS ACTIVE
    I had this issue when after filtering in ALV Table, th e bound Node wtill held original records......
    So is it something likeSORTING Updates the context,,,,,FILTERING does not ?
    Thanks
    Anand

  • How can I select the row after a cfgrid refresh?

    I have a form that is bound to a cfgrid.  The grid is populated from a database.  When you navigate in the grid the data displayed in the form changes to match the selected row.  I can edit the data in the form and update the database.  After updating the data I refresh the cfgrid, which then displays the updated data.
    Unfortunately the cfgrid always highlights the first row, row 0, after a refresh.  I want to highlight the same row that was highlighted when the data was edited and saved.  Can anyone advise as to how I can do that?
    I have tried setting a listener when the grid is initiated that responds whenever the store is refreshed and triggers the function refreshSelection():
    g.getStore().on('load', refreshSelection) ;
    Before the form data is saved, the row number is stored in selectedRow[0].  When the grid is refreshed, refreshSelection is run:
    function refreshSelection() {
    if (0 >= selectedRecords.length)
         return;
    alert('Selected row is Row ' + selectedRecords[0] ) ;
    g.getSelectionModel().selectRow(selectedRecords[0]) ;
    selectedRecords[0] = 0 ;
    The alert shows the correct row number each time, but highlighting the last row viewed works intermittently, and only if the alert line is active.  If I comment out the alert, this fails every time, with row 0 being highlighted.  selectedRecords[0] is reset to 0 after the attempt to select the row so that navigation through the grid, such as choosing "Next Page," will properly highlight the first row of the page rather than the last row number that was edited.
    -Rick

    Massage?
    Why not ask the masseuse who gave you the massage?

  • Select top row in Single Query?

    Hi
    Can somebody help me to write a query to get the first row after order by clause using single query alone.
    Example:
    I can write following query to select first row
    select * from (selec * from t order by col1) where rownum = 1;
    But here I should not use inline view to get the result. Because my original requirement needs to use this query in select list and it needs to use a column (of a table from the FROM clause) in the where clause of inline query. Because there is restriction that we can not use the column (of a table from the FROM clause) more than one level of inline query.
    Please help me.

    Raghav.786 wrote:
    Hi
    Can somebody help me to write a query to get the first row after order by clause using single query alone.
    Example:
    I can write following query to select first row
    select * from (selec * from t order by col1) where rownum = 1;
    But here I should not use inline view to get the result. Because my original requirement needs to use this query in select list and it needs to use a column (of a table from the FROM clause) in the where clause of inline query. Because there is restriction that we can not use the column (of a table from the FROM clause) more than one level of inline query.
    Please help me.
    What Oracle version are you?
    If you have 12c you can use
    select col1,...
      from t
    order by col1
    fetch first 1 row only;
    If less than 12c, you have can't do it without a subquery.
    What are you actually trying to do? Read Re: 2. How do I ask a question on the forums?
    and follow the advice there by giving example create table and insert sample data statements and
    explaining clearly what you are trying to do. Then we can help more.

  • CheckBox Item Renderer checks wrong grid row after sorting

    I have an advanced Data Grid that has a checkBox ItemRenderer. The underlying object being displayed (Server) in the dataGrid is being bound to the checkBox with a selectedForDeployment:Boolean property.
    I had this working just fine until the datagrid is sorted. After the grid is sorted I can click on the checkBox in row 2 and the checkBox in row 8 will be selected for instance. Or in some cases all checkBoxes will become checked. Also, if I have some already checked and then sort, the checkBox will become unchecked.
    I have an example of my itemRender below. Any idea on how I can get this to work:
    public class CheckBoxRenderer extends CheckBox
            override public function set data(value:Object):void {
                if(value){
                    super.data = value;
                    Server(super.data).addEventListener("setSelectionChanged", valueChange);
                    this.selected = value.selectedForDeployment;
            public function CheckBoxRenderer(){
                focusEnabled = false;
                BindingUtils.bindSetter(selectionChange, this, "selected");
            //this method occurs the checkbox is clicked
            public function selectionChange(value:Boolean):void{
                trace(value);
                this.selected = value;
                if(this.data){
                    this.data.selectedForDeployment = value;
            //This method occurs when the selectedForDeployment boolean in the object changes
            public function valueChange(event:Event):void{
                this.selected = event.target.selectedForDeployment;
            /* center the checkbox if we're in a datagrid */
            override protected function updateDisplayList(w:Number, h:Number):void
                super.updateDisplayList(w, h);
                if (listData is DataGridListData)
                    var n:int = numChildren;
                    for (var i:int = 0; i < n; i++)
                        var c:DisplayObject = getChildAt(i);
                        if (!(c is TextField))
                            c.x = (w - c.width) / 2;
                            c.y = (h - c.height) / 2;

    This usually works for me:
    package renderers
        import flash.events.Event;   
        import mx.controls.CheckBox;
        public class CheckBoxRenderer extends CheckBox
            public function CheckBoxRenderer()
                super();
                addEventListener(Event.CHANGE, handleChange);
            override public function set data(value:Object):void {
                if(value){
                    super.data = value;
                    selected = value.selectedForDeployment;
            private function handleChange(event:Event):void{
                data.selectedForDeployment = event.target.selected;

  • Dis-Select table rows after table update.

    Hello All,
    I have given the user a functionality to update table records on the BSP page.
    I am using multiselect first and then when user clicks on a button, the selected rows becomes editable...
    The user can then edit the rows and after they click on another button, the changes gets reflected in the database table....
    Now my problem is that when the table is updated, i am changing the selectionMode to Multiselect, but the rows still remains selected and i want to clear all the selected rows...i.e <b>dis-select all the rows...</b>
    Please help.
    I am using an iterator..

    Here you go..
    cl_htmlb_manager=>check_tableview_all_rows( rowcount = n
    request = request
    id = '<tableview id>'
    keytable = keytable "Table containing the key values of your itab
    check = '' ). "If its 'X' all items will be selected and ' ' will uncheck all items.
    <i>* Reward each useful answer</i>
    Raja T

  • Select specific row after a refresh

    I can not find this in the documentation. I have a table
    which list all my records from an XML. I then have a detail region
    that allows me to update the data in the CURRENT record. Upon
    submitting the updated data to the server, I need the record list
    refreshed, not a problem, and then the row previously selected to
    be selected again as current row. I have a Unique ID that my
    database assigns the records, but that will be different than what
    SPRY assigns. What is my best solution? I hope I have not
    miscommunicated this.
    Thanks,
    Lee

    This sounds like something that should be added to the data
    set api to help folks out. I've jotted it down. Until then, you can
    use something like this:
    function FindRowIDOfFirstMatch(ds, columnName, value)
    if (!ds || !columnName)
    return -1;
    var rows = ds.getData();
    var len = rows.length;
    for (var i = 0; i < len; i++)
    if (rows
    [columnName] == value)
    return rows["ds_RowID"];
    return -1;
    And call it like this:
    dsMyDataSet.setCurrentRow(FindRowIDOfFirstMatch(dsMyDataSet,
    '@id', '12345678'));
    Of course if there is the possibility that it might not find
    a row, then you would have to check for a -1 before calling
    setCurrentRow.
    For a data set observer example, look at this sample file in
    the zip file:
    Spry_P1_1_06-08/samples/SetCurrentRowSample.html
    --== Kin ==--

  • How to keep selection (or select) the row of SORTED ALV table?

    Dear Experts,
    I have WD ALV table with grouped and therefore sorted layout. I know that sorted ALV beahve differently.
    The problem is that if the values in cell is updated (setting attribute of selected element of context node bound to the ALV table), then the whole table is redrawn and selection disappears. It does not happen when layout of ALV is not sorted/grouped.
    I need somehow to select the ALV line again. Method MOV_To of IF_WD_CONTEXT_NODE for some reason is not working in sorted ALV (it selects element on node but not in ALV table). And in ALV Interface controller I also could not find anything usefull.
    Thanks.
    Best regards,
    Dmitry.

    Hallo Dmitry,
    See the sap note :1445428
    [https://service.sap.com/sap/support/notes/1445428|https://service.sap.com/sap/support/notes/1445428]
    Follow this thread which suggest a work around.
    [ALV Table set lead selection while sorting is enable for a column|ALV Table set lead selection while sorting is enable for a column]

  • Selecting top layer (after selecting all layers)

    Here's an odd thing: I found that
    app.activeDocument.activeLayer = app.activeDocument.layers[0];
    Works fine (as you would expect) in selecting the topmost layer, but fails to do just that after all layers have been selected.
    var id98 = stringIDToTypeID( "selectAllLayers" );
    var desc25 = new ActionDescriptor();
    var id99 = charIDToTypeID( "null" );
    var ref19 = new ActionReference();
    var id100 = charIDToTypeID( "Lyr " );
    var id101 = charIDToTypeID( "Ordn" );
    var id102 = charIDToTypeID( "Trgt" );
    ref19.putEnumerated( id100, id101, id102 );
    desc25.putReference( id99, ref19 );
    executeAction( id98, desc25, DialogModes.NO );
    // uncomment this to select the second layer and the code will work
    // app.activeDocument.activeLayer = app.activeDocument.layers[1];
    app.activeDocument.activeLayer = app.activeDocument.layers[0];
    Anyone know why this is the case?

    No idea why it should do this, but here is an alternative...
    selectTopLayer();
    function selectTopLayer(){
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL'));
    var ref2 = new ActionReference();
    ref2.putIndex(charIDToTypeID('Lyr '), count);
    var desc = new ActionDescriptor();
    desc.putReference(charIDToTypeID('null'), ref2 );
    desc.putBoolean( charIDToTypeID( 'MkVs' ), false );
    try{
    executeAction(charIDToTypeID('slct'), desc, DialogModes.NO );
        }catch(e){}

  • Selecting a row after dataset has loaded

    I have a situatioin where my server side logic supplies logic
    to provide a possition in the XML to be selected.
    EG:
    <script>
    var dsImages = new
    Spry.Data.XMLDataSet("/gallery.xml","/images/image");
    </script>
    and the server supplys a variable to say that "image 12 is
    selected"
    inline doesn't work as I guess the Javascript is firing
    before the dataset is loaded:
    EG:
    <script>
    var dsImages = new
    Spry.Data.XMLDataSet("/gallery.xml","/images/image");
    dsImages.setCurrentRow(12);
    </script>
    so I want to be able to fire a callback(?) function once the
    dataset is loaded
    Is this possible? or is there another solution do achive this
    someone know of?

    I found the answer in the previous post to this. (
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1251912&enterthread=y)
    Observers!

  • Show the checkbox as selected by selecting the row.

    Hi friends,
    I have a table. It is possible to select multiple rows, after selecting rows, I get the selected
    rows in this table from the context. Now my question is, how can i cause that by selecting a row
    the checkbox on this row will be also selected (shown as checked)?
    So this is the coding in the eventhandlermethod on onselect property of the table:
    METHOD onactionmark_cb .
      DATA lo_nd_table_data TYPE REF TO if_wd_context_node.
      DATA lo_el_table_data TYPE REF TO if_wd_context_element.
      DATA ls_table_data TYPE wd_this->element_table_data.
      DATA lt_table_data TYPE wd_this->elements_table_data.
      DATA lt_set TYPE wdr_context_element_set.
    DATA lv_idx TYPE i.
    navigate from <CONTEXT> to <TABLE_DATA> via lead selection
      lo_nd_table_data = wd_context->get_child_node( name = wd_this->wdctx_table_data ).
    This would now contain the references of all the selected rows
      CALL METHOD lo_nd_table_data->get_selected_elements
        RECEIVING
          set = lt_set.
      LOOP AT lt_set INTO lo_el_table_data.
        " Use the references to get the exact row data
        CALL METHOD lo_el_table_data->get_static_attributes
          IMPORTING
            static_attributes = ls_table_data.
        APPEND ls_table_data TO lt_table_data.
        CLEAR ls_table_data.
      ENDLOOP.
    mark/shhow the checkboxes checkd in the selected rows
    ENDMETHOD.
    Thank you for any help
    Haleh
    Edited by: Haleh Mir Ashrafi on Nov 9, 2008 6:29 PM

    Hi Haleh,
    I tried replicating your requirement and have written below the exact working code for the same. I will try to explain you my component so that you can get to understand its functionality. I have 2 tables & 1 input field in my view. The user enters a customer number in the input field and presses on a button. This leads to the corresponding sales orders filled into the 1st table ui element. The user then selects multiple rows from this table and presses on a toolbar button to copy these selected rows to the 2nd table. Within the same event I also set the checkbox for the rows selected by the user in the 1st tables row to selected. Hope that this would meet your requirement. On pressing the button the system would check if the checkbox is enabled & then mark the selected rows checkboxes as selected and would also copy the rows to the 2nd table. If the checkbox is disabled then the system would neither set it as checked nor copy it to the 2nd table. The rest of the checkboxes for the rows which weren't selected by the user remain as unchecked.
    METHOD onactioncopy_selected_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             ls_node1 TYPE ig_componentcontroller=>element_node1,
             lt_node1 TYPE ig_componentcontroller=>elements_node1,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set.
      wd_node = wd_context->get_child_node( name = 'NODE1' ).
      " Get all the context element information for the rows selected by the user
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
      " Just get the reference of the 2nd table to which you want to copy selected rows
      wd_node = wd_context->get_child_node( name = 'NODE2' ).
      LOOP AT lt_temp INTO wa_temp.
        CALL METHOD wa_temp->get_static_attributes
          IMPORTING
            static_attributes = ls_node1.
        " Check if the checkbox is disabled/enabled. The "enabled" property of the checkbox
        " is bound to the boolean context attribute by name ENABLED
        IF ls_node1-enabled EQ abap_true.
          wa_temp->set_attribute( EXPORTING name  = 'CHECKBOX'
                                            value = abap_true ).
          APPEND ls_node1 TO lt_node1.
          CLEAR ls_node1.
        ENDIF.
      ENDLOOP.
      " Bind the rows selected by the user to the 2nd table ui element
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.
    I have checked your code where you say like:
    IF elem_test->is_selected( ) = abap_true AND stru_test-enabled = abap_false.
    You had earlier fetched the entire elements list using the get_elements method of if_wd_context_node & then checking each 1 of them individually to determine whether it was selected or not using the method id_selected. You can directly get only the elements which were selected by the user by using the method get_selected_elements instead. So now you will only have to check whether the checkbox field in that particular row is disabled/enabled. You now don't have to combine 2 conditions using AND & check them within the loop.
    Regards,
    Uday

  • Row doesn't get selected after sorting

    I have a table bond to a javabean data control. I have enabled multi row selection. I get some rows on the table and then I select one of those rows, after that I use the value of the selected row for some operations.
    I have 3 columns, first name, lastname , email. The first 2 are sortable. If I click on the header of firstname, the information gets sorted ok (asc / desc). The problem is that after sorting, I can NOT select any rows. When I click on the row, it doesn't get highlighted, and If I try to use the value of the selected row I get a null pointer exception.
    Again this is happening only after sorting. If I don't sort, it works ok.
    I'm using JDEV + ADF 11.1.1.5.
    This is my code
    <af:table value="#{bindings.User1.collectionModel}" var="row" partialTriggers="::cb1"
    rows="#{bindings.User1.rangeSize}"
    emptyText="#{bindings.User1.viewable ? identityBundle.no_data_to_display : identityBundle.access_denied}"
    fetchSize="#{bindings.User1.rangeSize}" rowBandingInterval="0"
    id="t1" rowSelection="multiple"
    selectionListener="#{AssignRolesBean.onTableSelect}"
    binding="#{AssignRolesBean.searchResultsTable}"
    columnStretching="last">
    <af:column sortProperty="firstname" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.firstname.label}" id="c1"
    width="136">
    <af:outputText value="#{row.firstname}" id="ot4"/>
    </af:column>
    <af:column sortProperty="lastname" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.lastname.label}" id="c2"
    width="182">
    <af:outputText value="#{row.lastname}" id="ot2"/>
    </af:column>
    <af:column sortProperty="mail" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.mail.label}" id="c4"
    width="361">
    <af:outputText value="#{row.mail}" id="ot5"/>
    </af:column>
    <af:column sortProperty="uid" sortable="false"
    headerText="#{bindings.User1.hints.uid.label}" id="c3"
    visible="false">
    <af:outputText value="#{row.uid}" id="ot3"/>
    </af:column>
    </af:table>
    I have a selection listener only, I don't have a sort listener.
    My bean;
    AssignRolesBean
    public void onTableSelect(SelectionEvent selectionEvent) {
    GenericTableSelectionHandler.makeCurrent(selectionEvent);
    My makeCurrent method
    public static void makeCurrent( SelectionEvent selectionEvent){
    RichTable _table = (RichTable) selectionEvent.getSource();
    CollectionModel tableModel = (CollectionModel) table.getValue();
    JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding) tableModel.getWrappedData();
    DCIteratorBinding tableIteratorBinding = adfTableBinding.getDCIteratorBinding();
    Object selectedRowData = table.getSelectedRowData();
    JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
    Key rwKey = nodeBinding.getRowKey();
    tableIteratorBinding.setCurrentRowWithKey( rwKey.toStringFormat(true));
    SHOULD I IMPLEMENT A SORT LISTENER FOR THIS TABLE IN ORDER TO HANDLE ROW SELECTION PROPERLY AFTER SORTING?
    Is there a guideline for handling row selection after sorting?
    Thanks

    I have a table bond to a javabean data control. I have enabled multi row selection. I get some rows on the table and then I select one of those rows, after that I use the value of the selected row for some operations.
    I have 3 columns, first name, lastname , email. The first 2 are sortable. If I click on the header of firstname, the information gets sorted ok (asc / desc). The problem is that after sorting, I can NOT select any rows. When I click on the row, it doesn't get highlighted, and If I try to use the value of the selected row I get a null pointer exception.
    Again this is happening only after sorting. If I don't sort, it works ok.
    I'm using JDEV + ADF 11.1.1.5.
    This is my code
    <af:table value="#{bindings.User1.collectionModel}" var="row" partialTriggers="::cb1"
    rows="#{bindings.User1.rangeSize}"
    emptyText="#{bindings.User1.viewable ? identityBundle.no_data_to_display : identityBundle.access_denied}"
    fetchSize="#{bindings.User1.rangeSize}" rowBandingInterval="0"
    id="t1" rowSelection="multiple"
    selectionListener="#{AssignRolesBean.onTableSelect}"
    binding="#{AssignRolesBean.searchResultsTable}"
    columnStretching="last">
    <af:column sortProperty="firstname" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.firstname.label}" id="c1"
    width="136">
    <af:outputText value="#{row.firstname}" id="ot4"/>
    </af:column>
    <af:column sortProperty="lastname" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.lastname.label}" id="c2"
    width="182">
    <af:outputText value="#{row.lastname}" id="ot2"/>
    </af:column>
    <af:column sortProperty="mail" sortable="#{AssignRolesBean.columnSortable}"
    headerText="#{bindings.User1.hints.mail.label}" id="c4"
    width="361">
    <af:outputText value="#{row.mail}" id="ot5"/>
    </af:column>
    <af:column sortProperty="uid" sortable="false"
    headerText="#{bindings.User1.hints.uid.label}" id="c3"
    visible="false">
    <af:outputText value="#{row.uid}" id="ot3"/>
    </af:column>
    </af:table>
    I have a selection listener only, I don't have a sort listener.
    My bean;
    AssignRolesBean
    public void onTableSelect(SelectionEvent selectionEvent) {
    GenericTableSelectionHandler.makeCurrent(selectionEvent);
    My makeCurrent method
    public static void makeCurrent( SelectionEvent selectionEvent){
    RichTable _table = (RichTable) selectionEvent.getSource();
    CollectionModel tableModel = (CollectionModel) table.getValue();
    JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding) tableModel.getWrappedData();
    DCIteratorBinding tableIteratorBinding = adfTableBinding.getDCIteratorBinding();
    Object selectedRowData = table.getSelectedRowData();
    JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
    Key rwKey = nodeBinding.getRowKey();
    tableIteratorBinding.setCurrentRowWithKey( rwKey.toStringFormat(true));
    SHOULD I IMPLEMENT A SORT LISTENER FOR THIS TABLE IN ORDER TO HANDLE ROW SELECTION PROPERLY AFTER SORTING?
    Is there a guideline for handling row selection after sorting?
    Thanks

  • Challenge: Grab N rows AFTER performing sort

    I am not an SOA developer, but am working with a team of people who use the tool to develop software for us. I have stated a business requirement which the developers tell me SOA cannot do. I am certain they are wrong, but not being versed in SOA, I'm unable to debate the point without turning to experts for help.
    All I want to do is select N+ rows from my table after it has been sorted on the "importance" column, i.e., "Give me the top 100 rows ordered by importance". I am also filtering on a "status" column, taking only those rows that have statue='A'.
    To code this in raw SQL, I would simply say:
    SELECT *
    FROM (
    SELECT <my fields>
    FROM <my table>
    WHERE
    STATUS = 'A'
    ORDER BY importance ASC
    ) where rownum <=100
    The way they have solved this issue in SOA is generating the following (again in native SQL):
    SELECT <my fields>
    FROM <my table>
    WHERE
    STATUS = 'A'
    AND ROWNUM <=100
    ORDER BY importance ASC
    These two are not equivalent, and the second query does not satisfy the goal. The developers are telling me that it is impossible to satisfy my query using SOA.
    The actual SQL that got generated by SOA is:
         SELECT <my fields>
    FROM <my table>
    WHERE
    STATUS = :1
    AND ROWNUM <= :2
    ORDER BY importance ASC
    FOR UPDATE NOWAIT
    Is there some way to get SOA to generate THIS instead? :
    SELECT <my fields>
    FROM (
         SELECT <my fields>
    FROM <my table>
    WHERE
    STATUS = :1
    ORDER BY importance ASC
    WHERE ROWNUM <= :2
    FOR UPDATE NOWAIT
    Edited by: user10593614 on Apr 26, 2012 6:49 AM

    The DB Adapter is able to call PLSQL API's.
    I have copied and pasted some code we used from one of recent patches:
    - Create a type var for the results of your query
    CREATE OR REPLACE TYPE ICSOA_ARAUTOINV_DISTRIB_TYP AS OBJECT(
    FIELD1 VARCHAR2(30),
    FIELD2 VARCHAR2(30)
    - Create a table of this type
    CREATE OR REPLACE TYPE ICSOA_ARAUTOINV_DISTRIB_TBL AS TABLE OF ICSOA_ARAUTOINV_DISTRIB_TYP;
    - Create your PLSQL using the params you need as simple types something like: (In a package)
    function CreateAction(
         p_param1 in number,
         p_parm2 in VARCHAR2,
         p_result out ICSOA_ARAUTOINV_DISTRIB_TBL,
         p_err_message out varchar2
    ) return number;
    - your fuction devlaration section needs a cursor something like
    cursor c_lines_rsp(p_1 in number, p_2 in varchar2) is
    select ICSOA_ARAUTOINV_DISTRIB_TYP(123,'rrr') from dual
    where p_1=1 and p_2='abc';
    - in your plsql have it return 0 on success and in the exception handler get it to put the error message in p_err_message:
    begin
    --use cursor to get data
    OPEN c_lines_rsp(p_param1,p_param2);
    FETCH c_lines_rsp BULK COLLECT INTO p_result;
    CLOSE c_lines_rsp;
    return 0;
    EXCEPTION
    WHEN OTHERS THEN
    x_err_message := 'Unknown Error ' || sqlerrm || ' ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE;
    return 99;
    end;
    If you point the DB adapater at this it will create all the nessecary xml's and wsdls. It should be easy to call this from a BPEL process.
    The DB Adapter will create the object var and table but prefer creating my own as it fits in better with the patching process.
    From experence I have learned to always return the error message to BPEL it makes debugging a lot easier.
    oh and you shouldn't use and commit or rollback statements in your PLSQL if you are using XA db connections. (SOA will preform a commit for you)
    Robert
    Edited by: RobertMetcalf on Apr 26, 2012 4:09 PM

Maybe you are looking for

  • Legacy data upload for Training & Event Management

    As per the requirement, the legacy /history data for training events is to be uploaded in the system. To start the process the data templates were prepared for uploading training objects like D (Business Event Group), L (Business Event Type) and E (B

  • Crash on Startup "scripting"

    I recently installed the Adobe production suite on my iMac 27in and everything was working fine and then yesturday I installed 8gb of ram and now upon startup of all my Adobe suite products I recieve a message that says "crash invoking "scripting" I

  • Commons Net - List files with more than a wildcard "*" in path

    Hello everybody! I�m starting to use commons net library in a java project, and I have this doubt: I need to list files in a ftp server, for instance, like this �action*/slot*-qual*.txt� i.e., I want to list all the files like �slot (something) � qua

  • Can you cure this problem ... no text cursor is available in the description box for step 4 of eBay.co.uk selling

    I use XP Pro SP3 + Firefox 16.0.2 Since yesterday, when trying to sell an item on eBay.co.uk, no text cursor is available in the description box for step 4, so it is not possible to enter text. However, text can be entered into all the other text box

  • I looking for a transaction for debug the IDOCS

    Hello friends, I looking for a transaction that allowed me to debug the IDOC´s when the direction is only 1 (Outbound),  for ex. for IDOC´s has direction 2 (Inbound) I used the WE19 transaction, and to choose the "Inbound Function Module" button and