no error-status for error on get-next with dynamic query

ingie

New Member
Hello all,

can anyone point me at a solution to this:

I have a dynamic query on a dynamic table, and I am
attempting to get a record from the query with an exclusive lock,
Now, I realise that I must be within a transaction to do this, but
i want to check programmatically whether an error is occuring due
to the lack of a transaction.

i.e. If I simply say:

hQueryHandle:get-first( exclusive-lock, no-wait).

then a Progress error is reported, but I wish to suppress this.

so, if I say instead

hQueryHandle:get-first( exclusive-lock, no-wait) No-Error.

I don't get the error reported, but the error-status is still false !!

so I thought I would use a non-void call:

lOK = hQueryHandle:get-first( exclusive-lock, no-wait) no-error.

.... but whether this works or fails, the lOK flag is still true in all cases....


.... anyone got any good way of checking for this error state ?


cheers,

Ing.
 

jongpau

Member
Hi,

Try the following:

...
...
hQueryHandle:get-first(exclusive-lock, no-wait) NO-ERROR.
IF ERROR-STATUS:NUM-MESSAGES GT 0
THEN DO:
MESSAGE
ERROR-STATUS:ERROR SKIP
ERROR-STATUS:NUM-MESSAGES SKIP
ERROR-STATUS:GET-MESSAGE(1) SKIP(1)
"Hey this appears to work!!!":L
VIEW-AS ALERT-BOX.
/* do any other processing you want here */
END. /* error-status:num-messages gt 0 */

/* Continue normal processing */
..
..

For some reason (unknown to me) ERROR-STATUS:ERROR is not always true when there are messages. If you check on the number of messages you will however be able to see if the error has ocurred.

HTH.

Paul de Jong
 
Top