1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

listbox in runtime in Oracle Forms ?

Discussion in 'Oracle Forms and Reports' started by TeAmEr, Jan 5, 2009.

  1. TeAmEr

    TeAmEr Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    hi all again
    i have one small request
    i just want to be able to add values to a list box in runtime :eek:
    any help plz
     
  2. apps_expert

    apps_expert Forum Expert

    Messages:
    325
    Likes Received:
    28
    Trophy Points:
    330
    Location:
    Chennai, India
    hi, do u mean that you want to load a column from table in a list box during runtime? If yes, then let's say you have table called ClubOracle with two columns, userid and username.

    Call this procedure in a PRE-FORM or When-New-Instance-Trigger:
    Code (Text):

    PROCEDURE Build_Group IS
      LC$Req Varchar2(512) ;
      RG_NAME Varchar2(15) := 'RG_GROUP' ;
      rg_id RecordGroup ;
      errcode NUMBER ;
    BEGIN
      LC$Req := 'Select username, userid From cluboracle order by 1' ;
      rg_id := Find_Group( rg_name );
      IF Id_Null(rg_id) THEN
        rg_id := Create_Group_From_Query( rg_name, LC$Req ) ;
      End if ;
      errcode := Populate_Group( rg_id );
     
      CLEAR_LIST('BL.LIST_ITEM');
      POPULATE_LIST('BL.LIST_ITEM', rg_id );
     
    END;
     
     
  3. tyro

    tyro Forum Genius

    Messages:
    368
    Likes Received:
    20
    Trophy Points:
    260
    Location:
    India
    Hmmm let's see,

    First Create a table and testdata:
    Code (Text):

    create table cluboracle (userid number, text varchar2(30));
     
    insert into cluboracle (userid, text) values (1, 'tyro');
    insert into cluboracle (userid, text) values (2, 'TeEmEr');
    commit;
     
    Now we need to Create Recordgroup RG_CLUBORACLE with query:
    Code (Text):
    SELECT TEXT LABEL, TO_CHAR(USERID) VALUE FROM CLUBORACLE
    Create Listitem B.LIST with datatype NUMBER (30)
    Create WHEN-NEW-FORM-INSTANCE-trigger with code:

    Code (Text):
    DECLARE
        newTest NUMBER;
    BEGIN
        newTest:=POPULATE_GROUP('RG_CLUBORACLE');
        POPULATE_LIST('B.LIST', 'RG_CLUBORACLE');
    END;
     
  4. TeAmEr

    TeAmEr Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    thanks :) really it worked :)
    but am having a problem now :-( when i run the forms an error tells me that the list is empty but the forms run ok.