prevent deletion of record [message #454660] |
Thu, 06 May 2010 14:08 |
dgloeppky
Messages: 28 Registered: May 2010
|
Junior Member |
|
|
Hello,
Form has insert and delete enabled.
I would like to prevent the deletion of a record based on some column value.
Something like:
IF (COLA value < 10) THEN
SHOW ALERT;
RECORD IS NOT DELETE
ELSE
DELETE RECORD AS NORMAL
END IF;
I want this to happen even before the record is marked for deletion, but I don't know where to put it. I tried a pre-delete trigger, but it does not work they way I want.
|
|
|
|
Re: prevent deletion of record [message #454670 is a reply to message #454666] |
Thu, 06 May 2010 15:17 |
dgloeppky
Messages: 28 Registered: May 2010
|
Junior Member |
|
|
What would I put in the KEY-DELREC trigger?
You ARE allowed to delete records in the block, just not records that fail a conditional check, so wouldn't setting any block properties apply to all records?
Basically...
If I am on a record that will fail the check, delete is not possible, and will show an alert.
If I am on a record that will pass the check, go ahead and delete it.
|
|
|
|
Re: prevent deletion of record [message #454677 is a reply to message #454670] |
Thu, 06 May 2010 18:27 |
dgloeppky
Messages: 28 Registered: May 2010
|
Junior Member |
|
|
ColA just symbolizes 'some' column - :MYBLOCK.COLUMNA.
I assume the KEY-DELREC trigger would be on ColA item, as opposed to the block level?
I tried the following on the block level trigger and it does not work:
BEGIN
IF (:MYBLOCK.COLUMNA < 10) THEN
ALERT_HISTORICAL_RECORD;
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;
If a select record/remove on a record where COLUMNA is greater than 10, nothing happens. When I commit, I get a FRM-40401 'No changes to save'.
[Updated on: Thu, 06 May 2010 18:30] Report message to a moderator
|
|
|
|
Re: prevent deletion of record [message #454778 is a reply to message #454660] |
Fri, 07 May 2010 06:42 |
dgloeppky
Messages: 28 Registered: May 2010
|
Junior Member |
|
|
I thought default forms processing would kick in and the record would be deleted I thought the only trigger which overrode default forms processing (in the case delete), is the ON-DELETE trigger?
Thanks!
|
|
|
|
|