Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy tables!!
Message
 
 
À
07/09/1997 01:21:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00047638
Message ID:
00048880
Vues:
20
>>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.

I have found that this is not the case. With each iteration of the scan loop, the work area for Table 1 will automatically be reselected.

If you are sayin e=6, instead of Replace e with 6, then you are setting a memvar to 6 rather than the field in table 1.
You could try putting a messagebox in the loop to inspect your field values.
I believe that the best way to modify table2 is to INSERT INTO, rather than Use/AppendBlank/gather.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform