Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 DEC 1989 | 1.15+ | EXPERT | WC_SRC_FILE%, WINDOW_COMMON%, REPLACE, READ, WC_WLOCKED% |
A user in Cardiff had a problem recently with trying to find an easy way of preventing records from being amended when certain trigger fields had been filled in. That is, they wished to allow time-sheets to be entered and amended UNTIL an invoice had been produced. After the invoice was produced (and the invoice number was stored in the time-sheet record) the user had to be able to call up the time-sheet on screen and scroll through all values but not amend anything. The question was - "What is the most efficient way of achieving this ?"
The initial solution of setting all of the fields to protected worked but was cumbersome. A more elegant solution was achieved by the realisation that when a record is locked on the network, no editing is possible. Once this was realised, duplicating this functionality provided the better solution. The answer was to use a replace read process coded as follows
$INSERT WINDOW_COMMON% READ @RECORD FROM WC_SRC_FILE%, @ID THEN IF @RECORD<55> THEN * Or whatever condition you wish to assign WC_WLOCKED% = 0 UNLOCK WC_SRC_FILE%, @ID END END ELSE @RECORD = "" END
The WC_WLocked% = 0 instructs the window processor that the record could not be locked and is therefore NOT available for editing. However because the window processor thinks that the record is locked it will not attempt to unlock it after the record has been exited. The record must therefore be explicitly unlocked by the process.
(Volume 1, Issue 7, Page 3)