Deleting record from table and from populated tree the same time [message #84475] |
Fri, 19 March 2004 00:52 |
Solveiga
Messages: 36 Registered: March 2003
|
Member |
|
|
Hello to all,
I created a hierarchical tree for my table with self join. Here I display all data from that table.
Next to the tree, I created a data block, there I see all my table's data fields.
Then I created two buttons. One from them is New (record) and other Delete (record)
When I push "New", I want the record to be inserted to the table and to the tree
When I push "Delete", I want the record to be deleted from table and from tree, too.
My code:
--In when-new-form-instance populating the tree
DECLARE
selektas VARCHAR2(500);
rg_name VARCHAR2(40) := 'RG_DAL_MED';
rg_id RecordGroup;
find_node Ftree.NODE;
n NUMBER;
m NUMBER;
htree ITEM := Find_Item('MEDIS');
BEGIN
rg_id := Find_Group(rg_name);
IF NOT Id_null(rg_id) then
DELETE_GROUP(rg_id);
END IF;
selektas := 'Select 1, level, DAL_PAV, NULL, DAL_ID from T_DAL
start with PAVALD_ID is null
connect by prior DAL_ID=PAVALD_ID';
rg_id := Create_Group_From_Query(rg_name, selektas);
n := Populate_Group(rg_id);
n := Get_Group_Row_Count(rg_id);
IF n > 0 THEN
Ftree.set_tree_property(htree,Ftree.record_group,rg_id);
END IF;
END;
--when-button-pressed (button "New"),
--but first I enter values for my new record(pree another button "Insert record"
declare
htree ITEM;
top_node ftree.node;
new_node FTree.node;
item_value NUMBER;
item_name VARCHAR2(100);
begin
htree := Find_Item('F_MEDIS.MEDIS');
item_value := :T_DAL.dal_id;
item_name := :T_DAL.dal_pav;
new_node := Ftree.add_tree_node(htree,
Ftree.root_node,
Ftree.parent_offset,
Ftree.last_child,
Ftree.expanded_node, item_name, NULL, item_value);
end;
-- when-button-pressed "Delete"
declare
htree ITEM;
top_node ftree.node;
delete_node FTree.node;
delete_value varchar(100);
begin
delete_record;
htree := Find_Item('F_MEDIS.MEDIS');
delete_value := :T_DAL.dal_pav;
delete_node := Ftree.find_tree_node(htree,delete_value,
Ftree.FIND_NEXT,
Ftree.node_label,
Ftree.root_node,
Ftree.root_node);
IF NOT Ftree.ID_NULL(delete_node) then
Ftree.delete_tree_node(htree, delete_node);
end if;
end;
My question: when I inserting everything works properly... I insert new record, then I push button "New" and see a new node in my tree appears.
But when I want to delete a record, I select a node in a tree, when press butto "delete" and get such an error
FRM-99999: Error 7343 occured. See the release notes file (relnotes) for information about this error.
My record is deleted, a node from tree deleted...
Mabe you have some addvices for me, how to go arround this error or how to delete a record from table and from tree the same time. Some other triggers or codes?
Solveiga
|
|
|