>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.
>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)
Sam:
If your code above is the actual code, you have neglected to reselect table 1 before just the endscan; you are still in table 2 so you're only getting one record in table 1 processed. You must always be selected to the scanned table when the loop iterates.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement