Key and Modified should work in the scenario you describe.

Both people get Key = XXXXX and Count = 27

The Update statement generated by VFP should be something along the lines of:

UPDATE Inventory SET Count = 26 WHERE Key = "XXXXX" AND Count = 27

The first record should succeed and the second one should fail because the data 
for count does not
equal 27 anymore after the update. The lookup fails to find the record it wants 
to update and
TABLEUPDATE() returns false.

Couple things to check:
1) You have a TABLEUPDATE() and you check to see the result, and the result is 
true.
2) The TABLEUPDATE() is not performing a Force (second parameter).
3) The framework is not changing the view or cursor to use Key Only for the 
WhereType after it is
open (verify with CursorGetProp().

Rick
White Light Computing, Inc.

www.whitelightcomputing.com
www.swfox.net
www.rickschummer.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Trogdon
Sent: Monday, October 27, 2008 09:19 AM
To: [EMAIL PROTECTED]
Subject: RE: View Resolution Conflict

The view is set to Key and modified fields and Update using SQL Update.  The 
changed data is based
on the value of an existing field.  So first, you have to get the value, add or 
subtract one from it
and then save it.  The problem I'm seeing is if two people query the view at 
the same time and grab
the same starting value.  For example, two users requery at the same time and 
get a start value of
27.  One user adds one to 27 and the other user subtracts one from 27.  Whoever 
saves last wins
which throws the count off.

So I'm throwing around the idea of a timestamp for my local views.  I create a 
number field in the
table and update the view to reflect that.  I then set a variable to the value 
of the SECONDS()
command.  The user saves that value.  I then requery again and check to see if 
the timestamp number
is the same.  If it is, then I can write my value, otherwise I delay a second 
and then loop again.

The function I'm trying to accomplish here is basic inventory and shipping.  
One user is adding to
inventory while another is subtracting it out by shipping the same product.  
I'm sure this isn't
anything new but when working with local views/SQL, I'm not sure how to 
guarantee the right value
gets written since I can't lock a local view/SQL.





_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to