Consultor Eletrônico



Kbase 15916: What is ADM-ERROR and how should it be used?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
What is ADM-ERROR and how should it be used?

WHAT IS ADM-ERROR?
==================
ADM-ERROR is a character string return value recognized
by ADM code to indicate that an error has occured. This
allows for the undoing of a transaction when an error
occurs during updates.

This is shown with adm-assign-record where it checks for
errors and will undo the transaction and return
"ADM-ERROR" if an error occurs. By returning "ADM-ERROR"
this procedure has communicated to the procedure that
dispatched it, that an error has occured and that
procedure will also need to return "ADM-ERROR".

HOW SHOULD ADM-ERROR BE USED?
=============================
If you write any local methods that are involved in an
update, you should be returning "ADM-ERROR" to ensure that
the communication that an error has occured continues.
After running dispatch in a local procedure the following
should be added:

IF RETURN-VALUE = "ADM-ERROR":U THEN
RETURN "ADM-ERROR":U.

This should also be included in any custom layer of code
involving updates that has been added with
ADM-DISPATCH-QUALIFIER to augment ADM code.

For example, in order to apply data dictionary validation
to a field in a SmartViewer you must do the following in a
local-assign-record:

IF (Customer.Balance:VALIDATE() IN FRAME F-Main THEN
RUN dispatch IN THIS-PROCEDURE (INPUT 'assign-record':U).

Without returning "ADM-ERROR", there can be very strange
results when the program is run. The user will get the data
dictionary validation message that there is an error in what
has been entered, but then it continues on and asks if the user
wants to save the changes, if the user responds with "yes" then
they get the data dictionary validation message again.

By modifying the local-assign-record to do the following:

IF (Customer.Balance:VALIDATE() IN FRAME F-Main THEN
RUN dispatch IN THIS-PROCEDURE (INPUT 'assign-record':U).
ELSE RETURN "ADM-ERROR".

the data dictionary validation message displays and the
balance field is highlighted so the user can fix the error.


Progress Software Technical Support Note # 15916