Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Offline Views - mobile data entry
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Offline Views - mobile data entry
Miscellaneous
Thread ID:
00361941
Message ID:
00361941
Views:
60
I use a parameterized view to download subsets of records from a table – it is actually a 4 tables join, but only one table is updated. All tables have integer type primary keys, and there are no new records added to the off line tables. There can be any number of downloaded subsets, and it should be possible to download or upload at any time.

The download form sets the view parameters, then creates the offline files and copies them to the local drive. The code looks like this (I’ve trimmed out all return code checks, progress messages, etc...):
* Drop the view, if it is offline, in form’s init
* Create offline files (PMOFF)
   =CREATEOFFLINE('lv_testlog','x:\foxv\wa\PMOFF')
* Mark downloaded records as off line to prevent double download….
   USE x:\foxv\wa\PMOFF IN 0
   REPLACE ALL offln WITH .T.
   USE x:\foxv\wa\PMOFF ONLINE EXCLUSIVE
   =TABLEUPDATE(1,.T.)
   USE
* Copy offline files to laptop
   COPY FILE x:\foxv\wa\PMOFF.* TO c:\foxv\wa

The <b>upload form</b> does this:

* Copy PMOFF.* files from laptop
   COPY FILE c:\foxv\wa\PMOFF.* TO x:\foxv\wa
* Mark uploaded records as on line
   USE PMOFF IN 0
   REPLACE ALL offln WITH.F.
* Update source table in database
   USE x:\foxv\wa\PMOFF ONLINE EXCLUSIVE
   =TABLEUPDATE(1,.T.)
This is my test:
1 - download a set to c:\foxv\wa\PMOFF – using the download form
2 - copy PMOFF files to subdirectory c:\foxv\wa\pm1\
3 - download another set to c:\foxv\wa\PMOFF – using the download form
4 - copy PMOFF files to subdirectory c:\foxv\wa\pm2\
5 – make some changes in the two sets
6 - copy PMOFF files from c:\foxv\wa\pm1\ to c:\foxv\wa\
7 - upload – using the upload form
8 - copy PMOFF files from c:\foxv\wa\pm2\ to c:\foxv\wa\
9 - upload – using the upload form

All works fine first time, I tested only with sets that contain different records.
I try then to download again a set containing records previously updated. All return codes are .T. including the TABLEUPDATE(1,.T.), but this time no updates are done in the source tables. If I open the offline table (I do not drop the offline immediately) it contains some garbage, sometimes less records. I must be doing something illegal...

Any hint will be appreciated.
Doru.
Doru
Reply
Map
View

Click here to load this message in the networking platform