Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refresh Local copy of server Lookup Table
Message
From
14/06/2001 22:15:54
 
 
To
14/06/2001 04:23:49
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00519204
Message ID:
00519795
Views:
12
>Can anyone show me how to keep a copy of server lookup table at local. And refresh the local data when server data change.
>
>Thank u.




you can shorten the refresh time or open the same table again on searching...

SET REFRESH TO 60 && refresh data per min.

IF your lookup table is used to check the LastKey entry.

This is better to reopen the data to check it on.
because there are some code delay time even another application not yet update the Lookup table.

From The Below example, you will see the update lookup table coding is quite last action to do.
during the time, maybe some other machine also ask for adding records and
got problem on duplicate KEY order_NO
Well, it also use another method to ensure the Key adding is NEW one.

Lookup Table here is good if your key adding is in the middle.

Such as there are some ORDER_NO in table are P3456, V1234....
and now use ORDER_NO with R2345
IF take the last # of TABLE, it will give you Vxxxx, which is NOT the real one you needed.
Maybe you need the one is R2866 then Generate R2867 ...


USE orders AGAIN IN 0 ORDER TAG ORDER_NO ALIAS chkOrders
CurLastKey = LookupOrds.ORDER_NO
NextKey = THISFORM.GenNewKey(CurLastKey)
RealNew = .F.

SELECT chkOrders
Do While !RealNew
  LOCATE FOR ORDER_NO = NextKey

  IF FOUND()  && Already Added
    NextKey = THISFORM.GenNewKey(NextKey)
    CONTINUE
  ELSE
    RealNew = .T.
  ENDIF
EndDO

* After exit the loop, the ORDER_NO in NextKey is the Real New Key.
* replace the new append orders record with a New Key b4 update
REPLACE ORDERS.ORDER_NO With NextKEY    

IF TABLEUPDATE(.T.) = .F.
  MessageBox([Fail to Add records], 16, [Add Orders])
ELSE
  REPLACE chkOrders.ORDER_NO with NextKey   && Update the data in Lookup table    

  MessageBox([Success in Adding Records], 64, [Add Orders])
ENDIF
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform