Making a record read-only (OpenInsight Specific)
At 18 DEC 2000 11:45:58AM a becker wrote:
Is there any way to set an individual record as read-only?
We have a situation where we could have many revisions to a given record. Only the latest revision is the current or active record. (The previous records are available for historical purposes only.)
When we write the new revision, we would like to make the old record read only.
We know that we can set the properties of the fields and controls on the old record to read only, but can we do it for an entire record with one command such as set_property (this record, read_only)
Thanks
At 18 DEC 2000 12:15PM Don Miller - C3 Inc. wrote:
You can make a record read-only by locking it in the READ event:
* get the key
* assume only CURRENT_KEY can be changed
KEY=GET_PROPERTY(CtrlEntId,"DEFPROP")
IF KEY ne "CURRENT_KEY" then
OPEN "MYTABLE" to TEMP thenLOCK TEMP,KEY else
handle the fact that it is in use somewhere else ..ENDEND ELSE .. handle open logic errorEND
CALL FORWARD_EVENT()
RETURN 0
You will also have to put some additional logic in the Save and Clear events to unlock the key and to clear the SAVEWARN property if it is only a lookup. There's probably a more elegant way to do this. Maybe you can loop through the controls and set the attributes there to disallow changes to the data fields. Sometimes this is a pain because you have to go through and clear them for a new record.
Don Miller
C3 Inc.
At 18 DEC 2000 01:34PM a becker wrote:
Thanks, Don.
Andy