Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy tables!!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00047638
Message ID:
00047655
Vues:
24
>Hi all,
>
>I having some problem of copying records from one table to another.
>I did the following:
>
>use table1
>
>scan for
> do case
> case f = 1
> e = 6
> otherwise
> endcase
> scatter fields like f_name, e to array
> use table2
> append blank
> gather from array fields f_name, e
>endscan
>
>The result I'm getting in the Table2 is that it ONLY copy one record from Table1 to Table2. And I know there are more than one records that could satisfy the scan for statement.

Scatter fields to array is only storing one record. Same with Append blank and gather... your only grabbing a single record, moving to second table, adding new singl record, and filling in the two values. Use COPY FOR somecondition TO ARRAY to get more than one record. Then use APPEND FROM ARRAY FIELDS... to move all records into second table.

>Another problem I had is that the context of the field in Table2 is all mess up. Is there anyway to copy fields from one table to another without mess up the order. (I thought the scatter and gather command can be use to match specific fields that I want copy over)

Field order shouldnt matter if you use FIELDS clause to specify. But since your using SCATTER Fields ..., e that e is a variable and not a field. that might be your problem there.

HTH, Rox
Roxanne M. Seibert
Independent Consultant, VFP MCP

Code Monkey Like Fritos
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform