Oracle Form 6i: How to put database data into List Item(Combo Box)? |
Last days around, i just tried to make some List Item(ComboBox) that filed from database selected. . .
It's pretty good and easy enough.
1.
Create Program Unit :PROCEDURE CREATE_Filenames_RG IS
-- Andrew Fraser v2.2 27th May 2010
-- Populate dynamic lookup
it_id1 Item := Find_Item('block.my_list_item');
group1_id RecordGroup;
GRP_status NUMBER;
V_Space varchar2(10) := ''''||'0'||'''';
BEGIN
group1_id := Find_Group('FILENAMES_RG');
IF NOT Id_Null(group1_id) THEN
delete_group(group1_id);
END IF;
group1_id := Create_Group_From_Query('FILENAMES_RG',
'SELECT field FROM table ORDER BY field') ;
Grp_status := Populate_Group('FILENAMES_RG');
IF Grp_status = 0 THEN
If Not Id_Null(it_id1) THEN
If Get_Item_Property(it_id1,Item_Type) = 'LIST' Then
Clear_List(it_id1);
Populate_List(it_id1,'FILENAMES_RG');
END IF;
END IF;
END IF;
End;
2.
Create/edit triggers to call this:
On form startup:
When-New-Form-Instance on the form as a whole:
CREATE_Filenames_RG;
3.
And/or on mouse click if you want the database table requeried every single time the user clicks on the dropdown:
When-Mouse-Click on the new item itself:
Clear_List('CAS_UPLOAD');
Clear_Item;
CREATE_Filenames_RG;