Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy fields
Message
De
29/11/2004 11:32:02
 
 
À
29/11/2004 02:32:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00965005
Message ID:
00965444
Vues:
11
As I stated in my last reply, if you want to replace existing records in NAN, YOU will have to locate the records before the GATHER instead of using APPEND BLANK. You must have some primary key field that uniquely identifies each record in NAN that you can use to SEEK or LOCATE the appropriate record before you do the REPLACE or GATHER.

If that key field is char19, you can do something like this:
USE xldata in 0
USE nan in 0
select NAN
*!* index nan or set order to an existing index to be able to 
*!* locate the appropriate record to replace
INDEX ON char19 to Lookforit

*!*  DELETE ALL fields EXCEPT char19&& how i can do this 

blank fields EXCEPT char19 all

select xldata

SCAN
   SCATTER memvar MEMO && included MEMO in case you have memo fields
   SELECT NAN
   IF !seek(m.char19,"NAN")
       *!* existing record was not found - add a new one
       INSERT INTO NAN FROM MEMVAR
   ELSE
      GATHER memvar field EXCEPT char19 MEMO && included MEMO in case you have memo fields
   ENDIF
ENDSCAN
or why not clear NAN and refill with contents of xldata
USE xldata in 0
USE nan in 0 EXCLUSIVE
select NAN
m.lcSetSafety = SET("safety")
SET SAFETY OFF
ZAP
SET SAFETY &lcSetSafety

select xldata

SCAN
   SCATTER memvar MEMO && included MEMO in case you have memo fields
   SELECT NAN
   INSERT INTO NAN FROM MEMVAR
ENDSCAN
Or if xldata is the same structure as NAN and NAN should contain the same records as XLDATA
USE nan in 0 EXCLUSIVE
select NAN
m.lcSetSafety = SET("safety")
SET SAFETY OFF
ZAP
SET SAFETY &lcSetSafety
APPEND FROM xldata
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform