Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with seek()
Message
From
11/10/1999 14:15:22
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Help with seek()
Miscellaneous
Thread ID:
00275057
Message ID:
00275057
Views:
60
please help i can't seem to get this code right,

********

Use F:\TEMP\DATA\CUSTOMERS IN 0 ORDER TAG LASTNAME ALIAS MAIN EXCLU
Use F:\TEMP\IMPORT\CUSTOMERS IN 0 ORDER TAG LASTNAME ALIAS IMP_MAIN EXCLU
Select IMP_MAIN
Scan
Scatter to Aimp_rec memvar
Select MAIN
Seek(LASTNAME)
If found()
Scatter to Amain_rec memvar
If Changes(@Amain_rec, @Aimp_rec, 37)
Gather from Aimp_rec memvar
Endif
Else
Append Blank
Gather from Aimp_rec memvar
Endif
Endscan
Close TABLES ALL

Function Changes
Parameters Amain_rec, Aimp_rec, nlen

For x = 1 to nlen
If Amain_rec(x) != Aimp_rec(x)
Return .T.
Endif
Next
Return .F.

*********

I have 2 tables I am comparing and I want to add a record to the main table is one doesn’t exist, from the import table, or if one does exist I want to overwrite it if it's changed. The problem I get is the main table only adds the last record from the import table. I think there is something wrong with the way I seek for the record or append it. My table structure has a field named "LASTNAME" that for now I am searching on but will change to a customer id number in production. Thanks in advance.

Bill
Next
Reply
Map
View

Click here to load this message in the networking platform