Huwaiza
Huwaiza

Reputation: 87

Populate oracle forms combo Box with item values

I have view form which displays the information of customer and items, i want to show the values in view form according to the branch name, if branch name is selected NYC, the sole information about that branch should be displayed, but the problem is i just can see 1 Value from my combo box and the information related to that only.

I have applied PL/SQL procedure which fetches me the values of branch name data, branch_name is column name and trigger when-list-changed and in there i called the program units in which i have procedure name get_list and on main block the trigger is when-windows-activated here also i have called get_list, the code of get_list is below:

 PROCEDURE GET_LIST IS
 where_string varchar2(5000);

 BEGIN
    go_block('CUSTOMER_ORDER');
    IF :BRANCH_NAME IS NOT NULL THEN
    where_string := ' BRANCH_NAME='''||:BRANCH_NAME||''' ';
         end if ;
    set_block_property('CUSTOMER_ORDER',default_where,where_string);
execute_query;  
 END;

the result i get is the values of only one branch_name value and information corresponding to that

Upvotes: 1

Views: 1864

Answers (1)

Barbaros Özhan
Barbaros Özhan

Reputation: 65218

You need to populate the item values, probably from a db table, for BRANCH_NAME when you start to run your forms, possibly through WHEN-NEW-ITEM-INSTANCE or PRE-FORM by using Add_List_Element() method with such a code below :

Declare
  i  pls_integer:= 1;   
Begin
   Clear_List('block1.branch_name');  
   for c in ( select * from yourschema.branches order by branch_code ) 
   loop
     Add_List_Element('block1.branch_name',i,c.branch_name,c.branch_code);
     i:=i+1;
   end loop;
End;

Upvotes: 1

Related Questions