Surpress Error when CREATE record

JvdB

Member
Hi Peggers,

If I have the following sample code I force the creation of an already existing record.

DEFINE TEMP-TABLE tmpTest
FIELD test AS INTEGER
INDEX test_pk IS PRIMARY UNIQUE test.

CREATE tmpTest.
ASSIGN tmpTest.test = 1.

lbUndo:
DO ON ERROR UNDO lbUndo, RETURN NO-APPLY:

CREATE tmpTest.

ASSIGN tmpTest.test = 1 NO-ERROR.

IF ERROR-STATUS:ERROR THEN UNDO lbUndo.
END.

I use NO-ERROR and on ERROR UNDO, Yet Progress still give me the Message that tmpTest already exists, even though I say undo on error.
How can i surpress that error?
I thought I shouldn't even get it anymore, or is progress still trying to complete the creation even though I say undo?
If so, then still how to surpress that and back out without seeing an error?

Thanx already,

J.
 
Hi Peggers,

Solved already, by making the DO loop a DO TRANSACTION.
Now the error not shows, The create is not undone but a record with all 0's is made. However this one can be deleted if there is an error-status:error to clean up.
Thnx anyways ;)

J.
 
Back
Top