Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with seek()
Message
De
11/10/1999 14:47:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00275057
Message ID:
00275082
Vues:
27
>>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
>
>First I would use SCATTER TO MEMVAR MEMO
>GATHER FROM MEMVAR MEMO for change
>INSERT INTO FROM MEMVAR for inserti
>
>Explain exactly what is happening, your not getting any edits only adds?

Dan,
I have 2 tables a main table and an identical structured table as my import table. To start the test I have no records in the main table and 840 diffrent records in the import table, I run the program and when I browse the main table after the only record I get from the imported table is the last record. I looked at the debugger and it seems to be scanning the import table 1 record at a time but not appending to the main. It seems to be over writing the 1 record over and over. ending up with just 1 record transfering in the end.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform