After executing the code below the customer buffer is no longer available.
I expected it to contain the customer, as the buffer is scoped similar to lVar.
What I did not expect was that there would be no record in the buffer.
I went through the return error statement documentation but it doesn't mention buffers.
I tried to add a find customer to a finally block in FindProc but it remains unavailable.
Is this expected behaviour ?
Is there a way to code the routine that it doesn't loose the record in the buffer ?
Tested in OE 11.3
def var lVar as char no-undo init "from main". def var lOutput as char no-undo init "from main". find last Customer. do on error undo, retry: run FindProc(input-output lOutput). end. disp (if avail customer then string(custnum) else "Not avail") lVar lOutput. procedure FindProc: define input-output parameter ioOutput as character no-undo. /*def var currentrowid as rowid. currentrowid = rowid(Customer). find Customer where rowid(Customer) = currentrowid.*/ find current Customer. lVar = "procedure". ioOutput = "procedure". return error. finally: ioOutput = "finally". find first customer. end. end.
The problem is not the return error per se. It is the fact that there is an undo happening but there is no transaction open. The AVM will not track buffers that are released outside of a transaction. If you were to change the DO ON ERROR.. to DO TRANS ON ERROR..., you would see that the original record is still available after the block is 'undone'.