Discussion:
Trigger Failed. Is it possible to change this message
(too old to reply)
Demetrios Panayotakopoulos
2004-10-31 06:24:30 UTC
Permalink
Hi,

Is it possible to change the "Trigger Failed" message to something more end
user friendly?

Demetrios, Greece
Stefan Wuebbe
2004-10-31 08:09:35 UTC
Permalink
Hi Demetrios -
Post by Demetrios Panayotakopoulos
Hi,
Is it possible to change the "Trigger Failed" message to something more end
user friendly?
Depends -
as far as the native Error 1539 goes, while it is not directly trappable
AFAIK (e.g. On Error does not work), when you use Buffering and
TableUpdate() returns .F., AERROR() will report it and you can run
your own message before TableRevert()

OTOH, I believe also the Form Wizard generates some code with a
similar message and maybe even the RI Wizard.. Not sure about
the latter since I don't use both.


hth
-Stefan
Demetrios Panayotakopoulos
2004-11-01 07:26:06 UTC
Permalink
Hi Stefan,

I trapped it succesfully using On error.
I just hoped that it might be an option to include my message in the
database (linked somehow with the trigger).

Thanks
Demetrios, Greece
Post by Stefan Wuebbe
Hi Demetrios -
Post by Demetrios Panayotakopoulos
Hi,
Is it possible to change the "Trigger Failed" message to something more end
user friendly?
Depends -
as far as the native Error 1539 goes, while it is not directly trappable
AFAIK (e.g. On Error does not work), when you use Buffering and
TableUpdate() returns .F., AERROR() will report it and you can run
your own message before TableRevert()
OTOH, I believe also the Form Wizard generates some code with a
similar message and maybe even the RI Wizard.. Not sure about
the latter since I don't use both.
hth
-Stefan
Olaf Doschke
2004-11-03 11:16:25 UTC
Permalink
Hi Demetrios,

If you get Error 1539, then use
AERROR(laError),

and you'll get:

laError[1]: 1539
laError[4]: Workaerea of the table for which the trigger failed, so Alias(laError[4]) gives the Alias.
laError[5]: 1 - Insert Trigger failed, 2 - Update Trigger failed, 3- Delete Trigger failed

But that is it. You won't know which reference or foreign
key to which second table is the reason for the error.

In a 3rd-Party Referential Integrity Code (ri-code)
builder called AMRI they added code into the trig-
gers, that generates a global variable with the exact
reason of the trigger failure, so you could then
use that. The foxpro ri-code is not very readable,
so it's a bit hard to extend that code and you
risk loosing the code the next time you rebuild
the ri-code...

AMRI has a german GUI and I don't know if there
is an english version planned.

If you don't mind that you could get it here:
ftp://ftp.prolib.de/public/VFP/AMRI320.zip

Bye, Olaf.
Demetrios Panayotakopoulos
2004-11-04 06:52:07 UTC
Permalink
Olaf,

Thank you so much for the help.

Demetrios, Greece
Post by Olaf Doschke
Hi Demetrios,
If you get Error 1539, then use
AERROR(laError),
laError[1]: 1539
laError[4]: Workaerea of the table for which the trigger failed, so
Alias(laError[4]) gives the Alias.
Post by Olaf Doschke
laError[5]: 1 - Insert Trigger failed, 2 - Update Trigger failed, 3- Delete Trigger failed
But that is it. You won't know which reference or foreign
key to which second table is the reason for the error.
In a 3rd-Party Referential Integrity Code (ri-code)
builder called AMRI they added code into the trig-
gers, that generates a global variable with the exact
reason of the trigger failure, so you could then
use that. The foxpro ri-code is not very readable,
so it's a bit hard to extend that code and you
risk loosing the code the next time you rebuild
the ri-code...
AMRI has a german GUI and I don't know if there
is an english version planned.
ftp://ftp.prolib.de/public/VFP/AMRI320.zip
Bye, Olaf.
Loading...