Populating Tree Item With Record Group In Oracle Forms

The below plsql program unit could be used in a WHEN-NEW-FORM-INSTANCE trigger to initially populate the hierarchical tree with data in Oracle forms.

DECLARE
htree ITEM;
v_ignore NUMBER;
rg_emps RECORDGROUP;
BEGIN
-- Find the tree itself.
htree := Find_Item(’treeblock.htree1’);
-- Check for the existence of the record group.
rg_emps := Find_Group(’emps’);
IF NOT Id_Null(rg_emps) THEN
DELETE_GROUP(rg_emps);
END IF;
-- Create the record group.
rg_emps := Create_Group_From_Query(’rg_emps’,
’select 1, level, ename, NULL, to_char(empno) ’ ||
’from emp ’ ||
’connect by prior empno = mgr ’ ||
’start with job = ’’PRESIDENT’’’);
-- Populate the record group with data.
v_ignore := Populate_Group(rg_emps);
-- Transfer the data from the record group to the hierarchical
-- tree and cause it to display.
Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_emps);
END;



原文地址:https://www.cnblogs.com/quanweiru/p/6220602.html