Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6 sp3, Remote Views and SQL Server 6.5
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00295864
Message ID:
00299020
Views:
54
>Philip,
>
>How do I prevent multiple users from viewing/working the same record at the same time? In our application we have groups of users that process the same list of records. They effectively leapfrog each other through the list. We currently accomplish this using record locking. Users can also search any record at any time. If the searched record is being worked by someone else they get read only access. Is logical record locking the only way to accomplish this (i.e. lock flag in record)? If yes, how do we prevent lock flags from being left set when the users pc crashes or gets powered off without the user logging out of the application?


Hi Shane,

First off, sorry for taking so long to get back to you. I guess it's been longer that I thought since I was last on UT. In any case the question you are asking is a tough one. Having users processing the same set of records simultaneously does not lend itself easily to clean client/server implemetation. We once had a similar scenario with an application we developed for a local call center. We did, as you suggest, have a lock flag on the relevant table. We ended up using a userid and datetime field combination on the server table.

For a user to actually "lock" a record, the app would populate the fields in one remote view, and issue a tableupdate to write the record back to the server. We then go to a second parameterized view selecting the record from the server table with that set of userid and datetime values. Then processing can begin. Other users will not choose a record unless the userid and datetime fields are empty. Obviously, their parameterized view will never draw records off the server with another users userid. Once a record has been processed, we set another field indicating so, clear out the userid and datetime stamp, and update the parameterized view.

We can clean out old record lock flags (incorrect ones left by crashes and the like) during user login. We clear a users old locks by looking for records with datetime stamp older than that of this login session.

Hope this helps.
Phil
_____________________________
Phil Miles
http://www.philmiles.com
phil@philmiles.com
Previous
Reply
Map
View

Click here to load this message in the networking platform