Home » Developer & Programmer » Forms » Stop the trigger's execution (6i, XP)
Stop the trigger's execution [message #359355] Sat, 15 November 2008 02:47 Go to next message
rajy_salim
Messages: 204
Registered: January 2008
Location: Beirut - Lebanon
Senior Member
Hi!

I need to stop the execution of a trigger upon a specific condition.
For example, if we have in the WHEN-BUTTON-PRESSED trigger,
if v = 1 then
  /*Stop the execution of the trigger*/
end if;
message('Hello World!!');

In this case, if the variable v = 1, the message "Hello World!!" must not appear because the execution of the trigger would have been stopped.
How can I accomplish this? Is there an instruction (like 'exit' in C++) which can do it?

Thanks

Rajy
Re: Stop the trigger's execution [message #359398 is a reply to message #359355] Sat, 15 November 2008 12:26 Go to previous messageGo to next message
Frank Naude
Messages: 4590
Registered: April 1998
Senior Member
Try this:

if v = 1 then
  /*Stop the execution of the trigger*/
  goto end_of_trig;
end if;
message('Hello World!!');
<<end_of_trig>>

Re: Stop the trigger's execution [message #359406 is a reply to message #359398] Sat, 15 November 2008 13:03 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Although such a workaround solution does the job, Forms have another mechanism which will stop trigger execution:
if v = 1 then
  /*Stop the execution of the trigger*/
  raise form_trigger_failure;               --> this!
end if;
message('Hello World!!');
Re: Stop the trigger's execution [message #359776 is a reply to message #359355] Tue, 18 November 2008 03:15 Go to previous message
rajy_salim
Messages: 204
Registered: January 2008
Location: Beirut - Lebanon
Senior Member
Thank you!!

Rajy
Previous Topic: open fmx from shortcut on new window
Next Topic: problem to update record in tabular form
Goto Forum:
  


Current Time: Sun Feb 09 09:09:49 CST 2025