Lab for Monday, March 2, 1998
How to Implement a Drop Down List on A Canvas
I've mentioned several times in class that you can implement a drop down list in a block without using a list of values (LOV). In this lab you'll implement a simple drop down list in your boat block. Before you can do so, you need to prepare a few things:
1, Tartan
2, Catalina
3, C&C
4, Hunter
5, Swan
6, Dehler
7, Hylas
8, Fontaine Pajot
9, Beneteau
10, Jenneau
-----------------------------------------------------
-- Function Init_Codes_Small
-- Written by: Andreas M. Olligschlaeger
-- Date Written: October 1996
-- Last Modified:
-- Purpose: Populates a list items from a code table
-- with single code fields. Returns 0 on
-- success, -1 on failure.
-----------------------------------------------------
FUNCTION INIT_CODES_SMALL(V_TABLE IN VARCHAR2,V_KEY IN VARCHAR2, v_item IN VARCHAR2) RETURN INTEGER IS
group_id RecordGroup;
list_id Item;
v_test number;
BEGIN
group_id := Create_Group_From_Query('vector',
'select DESCRIPTION,TO_CHAR('||V_KEY||') from '||V_TABLE||
' ORDER BY DESCRIPTION');
IF id_null(group_id) THEN
v_test := SHOW_ALERT('DATABASE_ERROR');
RETURN -1;
end if;
v_test:=Populate_Group('vector');
list_id := Find_Item(v_item);
IF id_null(list_id) THEN
v_test := SHOW_ALERT('DATABASE_ERROR');
RETURN -1;
end if;
Populate_List(list_id,group_id);
Delete_Group(group_id);
RETURN 0;
END;
Declare
V_test number;
Begin
V_test := Init_codes_small('Make_Codes','Code_ID','B_Boat.Make_List');
End;
Your pull down list will now automatically be populated each time you fire up the form. Also, when a user selects a make using the pull down menu, the correct code id will automatically be inserted into the boat table. A source code listing for a function that populates a list item for code table using multiple codes can be accessed from the web page.
Back to Main Page