key-delrec [message #349327] |
Sat, 20 September 2008 03:26  |
Muhammad Masoom
Messages: 5 Registered: April 2008
|
Junior Member |
|
|
hello
in master detail form, i m wanting if user in detail block then only detail records shuold be deleted and if in master then all record incluing master-detail should b deleted for this i wrote:
in master_block(purchase_req_header)
i wrote in
1-key-delrec trigger
delete_record;
2-i made another key-delrec trigger in detail_bloc(purchase_req_body)
here i wrote too
delete_record;
3-in button_block i created a delete button in which i wrote
do_key('delete_record');
when i pushed the delete button having cursor in detail block it deletes all record including master record.
my form's relation property is cascading but i tried from thrice properties. kindly give me any suggestion who can i solve it
|
|
|
Re: key-delrec [message #349449 is a reply to message #349327] |
Sun, 21 September 2008 21:28   |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Remove your code. Research 'Delete Record Behavior Property' when set to 'Cascading'.
David
PS "(Note: this property was formerly called the Master Deletes property.)"
[Updated on: Sun, 21 September 2008 21:28] Report message to a moderator
|
|
|
Re: key-delrec [message #349614 is a reply to message #349449] |
Mon, 22 September 2008 06:31  |
Muhammad Masoom
Messages: 5 Registered: April 2008
|
Junior Member |
|
|
thank you very much.problem has been solved,
i set delete record behaviour property as well as i had to use some global variables.
i am writing code for some other readers
step #1
In master block level: post-query trigger
:global.blk:='PURCHASE_REQ_HEADER';(It is Master Block)
:global.rec_no:=:system.trigger_record;
Step#2
In master block level: post-block trigger
:global.blk:=:system.current_block;
:global.rec_no:=:system.trigger_record;
Step#3
relation property: "delete record behaviour" =cascading
Step#4
in detail block level: when-mouse-click trigger
:global.rec_no:=:system.trigger_record;
in detail block level: post-block trigger
:global.blk:=:system.current_block;
Step#5
In button block
delete button: when-button-pressed
declare
n number;
begin
if :global.blk='PURCHASE_REQ_HEADER' then
go_block(:global.blk);
set_alert_property('alert_del',title,'DELETE');
SET_ALERT_PROPERTY('ALERT_DEL',ALERT_MESSAGE_TEXT,'Are You Sure to Delete the Master Record');
n:=show_alert('alert_del');
if n=alert_button1 then
delete_record;
commit;
clear_form;
end if;
end if;
if :global.blk='PURCHASE_REQ_BODY' then
go_block(:global.blk);
go_record(:global.rec_no);
set_alert_property('alert_del',title,'DELETE');
SET_ALERT_PROPERTY('ALERT_DEL',ALERT_MESSAGE_TEXT,'Are You Sure to Delete the Detail Record');
n:=show_alert('alert_del');
if n=alert_button1 then
delete_record;
commit;
end if;
end if;
end;
now your button is ready to delete from every block and from every record what ever you desired.
|
|
|