I need to delete a set of record in a table (Table1) applying filter. For each record in this table there may be other records in a secondary table (Table2).
In onDelete trigger there is code to cascade delete all record related in Table2. But in this code there is a confirm to ask user every time a record was deleted.
I want use trigger to delete related record but i need skip confirm. So I've create a global variable, hideConfirm, to skip this confirm and a procedure to set this variable.
This is code:
trigger OnDelete()
begin
if not HideConfirm then
if not CONFIRM(QstDeleteSchema, FALSE) then
exit;
Table2.SETRANGE(FieldFilter, FieldFilterValue);
Table2.DELETEALL;
end;
procedure SetHideConfirm(parHideConfirm: Boolean)
var
begin
HideConfirm := parHideConfirm
end;
This was main code that execute
RecordsetTable.SetHideConfirm(true);
RecordsetTable.DELETEALL(TRUE);
But when execute OnDelete trigger HideConfirm global variable was false...
Why?
0
Answers