Attached is a barebones solution named Locking101 with one form, three fields and three buttons with the methods shown below. The solution was created with Servoy 2.0 and Sybase.
I would appreciate anyone explaining how record locking can be setup in this solution, and if it can be done more than one way, I would like to know the pros and cons of each approach.
I tried opening the solution with Developer and setting the form’s onRecordEditStart property to the record lock method. Then I opened the client and clicked into a field. Then I opened a second client and got the “Could not retrieve form data” message. So I am not off to a good start. I would greatly appreciate hearing anyone else’s experiences, comments, suggestions, etc.
i also noticed that you are saying ‘Another user is modifying this record.’ in youre hasLocks method.
This is not the case .. hasLocks means that you have a lock set on the record not another user..
jcompagner:
i also noticed that you are saying ‘Another user is modifying this record.’ in youre hasLocks method.
This is not the case .. hasLocks means that you have a lock set on the record not another user..
Currently if a record is locked by one user and another user attempts to enter that record they are not allowed to enter any fields in the record and a red “Record is locked” message appears in the Status bar at the bottom of the screen. Until it was brought to my attention, I did not notice the red message. What I was trying to do is to also have a warning dialog come up explaining that “Another user is modifying this record”.
The way it is now, even if a user sees the red message, they will likely not understand what it means. As software people, it means somethng to us. But our average user would think “What does ‘Record is locked’ mean?”
Ideally, I would like to see a warning dialog come up that explains that another user is modifying the record and gives the name of that user. That way if that user is out having a cup of coffee, the current user can go over to their PC and click outside of the field to release the lock (or click the “Release all locks” checkbox from their Servoy Server Administrative web page). Another suggestion would be to have an option to automatically release the lock after 15 minutes has passed.
With regard to the “databaseManager.releaseAllLocks()”. Does it release all locks on all records for all tables for all users, or just release the current lock for the current record for the current table for all users? Or some other combination?
first of all. The text you are seeing there can be altered by the developers in the next release (2.5+ not the maintenace release 2.0.x)
We will see if we will popup a dialog with some warnings (that can be altered by the developer) or maybe we can give you some event that will trigger a javascript when a users clicks in a locked record..
Currently you can’t ask if a record is locked or not..
I just discovered that if locking is not set on a record and one client has clicked into a field and is typing data into that field and another user clicks into the same field and changes data, and then leaves the record. Then the data update on the first client is instantly displayed even though the first client’s cursor is still in the same field and the user is still typing information. The information typed by the first user after the other user entered the field is lost. In other words, clicking into a field and leaving the cursor in the field does not keep data from being updated in the field.
Lesson learned: If you are not setting a record lock, do not assume that there is going to be a field lock in place.
yes if you don’t want that behaviour then turn on locking.
We have to do this because what happens if we don’t do that?
Then what the first person just updated is overwritten by the second person even if the second person didn’t even see or notice that previous change!