Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select max() from a table with tablebuffer - HELP !!
Message
From
03/06/2002 15:21:25
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
03/06/2002 08:06:19
Joao Godinho
Fredesenvolv, Lda
Lisbon, Portugal
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00663992
Message ID:
00664231
Views:
26
>Hi !!
>
>Hi have two users and i want to find the maxium of a table column but ....
>I´m using table buffer and the tableupdate is decided by the user !!
>
>please help !! what i'm doing wrong ??
>
>Thank you ALL
>
>SET MULTILOCKS ON
>create database demo
>open database demo
>CREATE TABLE "orders.dbf" NAME orders ( order_id N(5))
>
>select 1
>use orders shared
>lSuccess=CURSORSETPROP("Buffering", 5, "orders")
>
>append blank
>replace orders.order_id with 1 &&->user 1
>
>append blank
>replace orders.order_id with 2 &&->user 2
>
>browse
>
>select max(order_id) from orders into array max_order_id &&->by user 1
>
>if type("max_order_id[1]") = "N"
> wait window str(max_order_id[1],5)
>else
> wait window type("max_order_id[1]")
>endif

In addition to what Cetin said, you can partly go around this using
calc max(order_id) to max_order_id
but that would give you only the current records that the user issuing that command sees; it won't necessarily see the value saved by the other user. It will also get your record pointer to eof() and if you have record-level buffering, it will force an implicit tableupdate(). But it will see the values the current user has in the buffers.

Basically, you can't see values which are not saved yet, and then you also shouldn't. The users can still change their minds about saving, or other things can happen that could prevent these values from getting into tables. So your reporting one of the noncommitted values as the current maximum would be inaccurate.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform