|
|||||||
Reader's Clinic - Preventing Records Being AmendedA 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 0001 $INSERT WINDOW_COMMON% 0002 READ @RECORD FROM WC_SRC_FILE%, @ID THEN 0003 IF @RECORD<55> THEN 0004 * Or whatever condition you wish to assign 0005 WC_WLOCKED% = 0 0006 UNLOCK WC_SRC_FILE%, @ID 0007 END 0008 END ELSE 0009 @RECORD = "" 0010 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) |
|||||||
| |||||||