Date:  12/07/2002 04:33:06 PM Msg ID:  001089
From:  James Williams Thread:  001063
Subject:  Re: Skipping right to a real problem

I may have two methods you can use to aceive record locking. They both use a datetime stamp.

 

Method 1

1. Create a Datetime field on all tables called "timestamp".

2. On edit of a record STORE the timestamp field value in the web page for checking later

3. On Save of a record check that the stored timestamp value is the same as the timestamp field value.

4. If timestamps are the same update the record and update the timestamp with the current date and time.

5. If timestamps are different you can give the user the option of forcing the update, or refresh the page with the new timestamp value and get the user to edit again.

 

This method i thought of because you mentioned a timeout.

Method 2

1. Create a Datetime field on all tables called "timestamp".

2. On Edit of record check if datetime stamp is less than current date and time if so then Edit if not tell user that record is currently being edited.

3. On allowing of Edit SET the timestamp field value to the current date and time plus 5 minutes (Replace TimeStamp with Datetime()+5*60).

4. On Save, check that the timestamp field is greater than the current date and time. if so update the record as normal but also update the timestamp with the current date and time (Replace TimeStamp with Datetime()) this will re-enable editing. if not tell the user their edit has timed out

 

Both methods will work without any outside program checking and clearing record locks.

 

PS. these methods are just thoughts as i was reading your posts.
 
Sent by Gene Gerard on 12/05/2002 06:07:55 PM:
Hi Don,

It took me about 2 months to get a handle on some of the things FoxWeb can do and not do  . . . and I feel I still have a long way to go.

My biggest problem was with how to transfer variables back and forth between HTML/Javascript and FoxWeb . . . but now I have a pretty good handle on it. Once you understand how to do that, you can create a lot of good code.

If you ever need help, send me a post directly at gbuza@logisticle.com

Regards,

Gene
Sent by Don Dascher on 12/05/2002 05:21:58 PM:
Well, you obviously have logged a few hours with this stuff ( I have none) so I guess you have a real world perspective.  I have to learn to walk first then take a shot at running. 
 
I like to keep everything real simple.  I am worried that this might not be easy to implement with this Web Stuff.  But I am in no rush ... I will just work into it a step at a time.
 
Good Luck with your new site.
 
Don