Post Read Process (AREV Specific)
At 06 OCT 2000 04:44:29PM Matt Sorrell wrote:
I'm having a problem with a post read process in a window.
We are using ARev 3.02.
In the post read, I check to see if this is a new record by checking for WC_OREC%. If it is a new record, I then validate that the key is valid in another table. The next step is to ask the user if they want to create a new record in the table. If they do, then I prepopulate some data into the record to minimize fat finger mistakes.
The problem is when one of the validations fails, or the users says they don't want to create a new record. To abort the process, and prevent the record from being displayed, I do the following:
@ID=Null$
WC_VALID%=False$
Status()=3
This effectively cancels the read, and the window is ready to accept another entry. However, if I type in the same key again, I get a message that the record is locked by this workstation.
I have tried placing unlock commands in the program, but those don't appear to be working.
I'm sure I am missing something simple, but would appreciate some help.
Thanks,
At 06 OCT 2000 06:52PM Bill Titus wrote:
Try resetting these additional WINDOW_COMMON% variables:
WC_ID_NEXT%='
WC_BROWSE_NEXT='
WC_NEW_BROWSE=1
@ANS='
WC_RESET%=RESET.RECORD$
Just be sure to $INSERT SYSINCLUDE,WINDOW.CONSTANTS or RESET.RECORD$ will be undefined.
Hope it helps.
Bill
At 06 OCT 2000 08:29PM Bill Titus wrote:
Try resetting these additional WINDOW_COMMON% variables:
WC_ID_NEXT%='
WC_BROWSE_NEXT%=' ;* couldn't see % was missing in previous post
WC_NEW_BROWSE%=1 ;* "
@ANS='
WC_RESET%=RESET.RECORD$
Just be sure to $INSERT SYSINCLUDE,WINDOW.CONSTANTS or RESET.RECORD$ will be undefined.
Hope it helps.
Bill
At 07 OCT 2000 05:47AM Cameron Christie wrote:
Matt,
I no longer have 3.02 (shame on me!) but I'm sure it will comfort you to know that the following does work fine in 3.12 - you were doing the unlock BEFORE resetting @Id to null I presume???
WC_Valid%=False$
Unlock WC_Src_File%,@Id
@Id=Null$
FWIW, in this situation I would be tempted to split the logic into two sections anyway. Have a PRE-read process handle the validation - you'll need to read any existing record yourself though - and your current code (minus the Status() setting) will work just fine as there is no locking at this point. Then have a post-read process update the record safe in the knowledge that it has the "rights" to do do.
Cameron
At 09 OCT 2000 09:42AM matt sorrell wrote:
Cameron,
you were doing the unlock BEFORE resetting @Id to null I presume???
Ya know, I knew I was missing something simple. Moved that line of my code down a little further, and everything works fine.
That's what I get for trying to write code when I'm more interested in going home than writing code.
Oh well, it was a Friday.
Thanks for the help!!!
At 10 OCT 2000 03:16AM Cameron Christie wrote:
Matt,
The reason I spotted the potential mistake so quick is because I make SO many of them myself!
You're welcome!
Cameron