This discussion is archived
12 Replies Latest reply: Feb 6, 2013 1:45 AM by 942420 RSS

List Item Problem

942420 Newbie
Currently Being Moderated
Hi Team,

I am using Oracle forms 10g R2 on windows XP.

I have 6 item in tabular block which will display data from database depending on values provided by another block item. I want data should be order by any of this 6 item which should be chose by user.

So I have Created one list_item and allow user to choose order by column, and use that item in my order by clause query.
Ex: ORDER BY :BLOCK.LIST_ITEM

But the data is not coming in order selected by user.

I have checked value for :BLOCK.LIST_ITEM , value is coming but sorting is not getting.
  • 1. Re: List Item Problem
    HamidHelal Guru
    Currently Being Moderated
    parapr wrote:
    Hi Team,

    I am using Oracle forms 10g R2 on windows XP.

    I have 6 item in tabular block which will display data from database depending on values provided by another block item. I want data should be order by any of this 6 item which should be chose by user.

    So I have Created one list_item and allow user to choose order by column, and use that item in my order by clause query.
    Ex: ORDER BY :BLOCK.LIST_ITEM

    But the data is not coming in order selected by user.

    I have checked value for :BLOCK.LIST_ITEM , value is coming but sorting is not getting.
    Hi parapr
    In your When-List-Change trigger use
    go_block('block_name');
    execute_query;
    Hope this helps...
  • 2. Re: List Item Problem
    Amatu Allah Guru
    Currently Being Moderated
    Hi

    Additionally,u can use the block's property > Order By > :BLOCK.LIST_ITEM
    instead of query use...

    Amatu Allah
  • 3. Re: List Item Problem
    942420 Newbie
    Currently Being Moderated
    Hi HamidHelal ,

    I have add below code in When-List-Change trigger

    go_block('block_name');
    execute_query;

    Still Not working.


    block's property > Order By > :BLOCK.LIST_ITEM. This also not working.

    Any other option will solve this issue.
  • 4. Re: List Item Problem
    HamidHelal Guru
    Currently Being Moderated
    Try this
    GO_BLOCK('EMP');
    Set_Block_Property('EMP',ORDER_BY,:BLOCK2.LST_ITEM); 
    EXECUTE_QUERY;
    Hope this works..
  • 5. Re: List Item Problem
    G.Y Newbie
    Currently Being Moderated
    Ex: ORDER BY :BLOCK.LIST_ITEM
    hello dear
    Go to your block property pallate
    write in Order By clause BLOCK.LIST_ITEM
  • 6. Re: List Item Problem
    942420 Newbie
    Currently Being Moderated
    Block Property also set but not working.

    I Have written a code to retrieve data from database in a button through cursor.
    In cursor query I have order by clause where I am using :BLOCK.LIST_ITEM, But not working.

    Any help is appreciated.
  • 7. Re: List Item Problem
    Andreas Weiden Guru
    Currently Being Moderated
    Hamid's code should work:
    GO_BLOCK('EMP');
    Set_Block_Property('EMP',ORDER_BY,:BLOCK2.LST_ITEM); 
    EXECUTE_QUERY;
    replace EMP with your datablock-name, and make sure that BLOCK.LST_ITEM contains correct values. You can check that after executing a query by showing the contents of :SYSTEM.LAST_QUERY, e.g. using message.

    Edited by: Andreas Weiden on 05.02.2013 21:26
  • 8. Re: List Item Problem
    942420 Newbie
    Currently Being Moderated
    Hi Andreas,

    ORDER BY clause cannot reference global variables or form parameters.

    So I have use
    set_block_property('bl_bank_reco',default_where,v_query);
    In v_query I use logic for order by, still not working

    My Block is non database block, thats why its not working or what?
  • 9. Re: List Item Problem
    HamidHelal Guru
    Currently Being Moderated
    My Block is non database block, thats why its not working or what?
    Hi,
    Now it's clear to me. Please always provide details information when post any problem.

    Parameter in ORDER BY clause normally doesn't work. You need to work in different way. Re-write your cursor like
         CURSOR C IS
         SELECT EMPNO,ENAME
         FROM EMP
         ORDER BY  TRIM ( CASE  :TX_LIST --here is the list item with one value
                        WHEN  'ENAME'     THEN  ENAME
                        END
                ) ASC;
    Hope this works..


    Hamid


    If someone's response is helpful or correct, please mark it accordingly.*
  • 10. Re: List Item Problem
    942420 Newbie
    Currently Being Moderated
    Hi HamidHelal,

    Your Code is working but only for one condition, When I use multiple condition in CASE Statement Data itself is not coming.For single Condition it is working properly.
  • 11. Re: List Item Problem
    Amatu Allah Guru
    Currently Being Moderated
    hi
    Hamid's condition is just an example try using more than one case according to ursss.
    Amatu Allah
  • 12. Re: List Item Problem
    942420 Newbie
    Currently Being Moderated
    Now its working, use multiple case for multiple condition.

    Thanks HamidHelal, you are genius.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points