Friday, April 12, 2013

Dynamic List of Values (LOV)

By using this code you will create dynamic List of values in oracle forms builder.

1- Create table and insert data in to.
create table uom
(
uom_id number,
uom_name varchar2(25)
);
insert into uom
values(1,’pieces’);
insert into uom
values(2,’meters’);
insert into uom
values(3,’yards’);

2- Open forms builder and draw one field on forms builder with type “List Item”.

3-Write this code in “NEW-FORM-INSTANCE” trigger on form level.

DECLARE
GROUP_ID   RECORDGROUP;
LIST_ID       ITEM := FIND_ITEM(‘MY_ITEM_LIST’);
STATUS NUMBER;
BEGIN
GROUP_ID := FIND_GROUP(‘TYP’);
IF NOT ID_NULL(GROUP_ID) THEN
DELETE_GROUP(GROUP_ID);
ELSE
GROUP_ID := CREATE_GROUP_FROM_QUERY
(‘TYP’,'SELECT UOM_NAME,TO_CHAR(UOM_ID) FROM UOM’);
END IF;
STATUS := POPULATE_GROUP(‘TYP’);
POPULATE_LIST(LIST_ID,GROUP_ID);
END;

—————————————————————–

4 -Now Run this form you list is ready now.

To Download sample form for List Item Right Click and save as on target

LIST_ITEM_SAMPLE_FORM.fmb
* If you like this article then please leave comments on it……. :)

No comments:

Post a Comment

Thank You For Comment