Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacing records in table
Message
De
21/07/2000 11:45:45
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
21/07/2000 11:05:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00395142
Message ID:
00395479
Vues:
12
Tyler,
REPLACE .... WITH .... ;
    FOR packslip.studentid == cpack.studentid ;
    AND packslip.courseid == cpack.courseid in packslip

The conditions in your FOR clause determine how many records get replacement values.  Change the conditions so that you do only as many replacements as you want.  If you only want to replace in that one record, take out the FOR...  REPLACE defaults to NEXT 1. 



>My code isn't correct. I found out what the problem is. In the scan of cpack it takes the first record replaces all the records in packslip with it then goes to the next record of cpack and replaces all the records in packslip that match the courseid and studentid. So at the end I have the last record of cpack replacing all the records in packslip. Here is my code:

<pre>
>select cpack
>	scan
>	quant = iif(inlist(materialid,"VX29","VX39"), qty3, iif(inlist(materialid, "VX57","VX50"),qty2,iif(inlist(materialid, "VX51"),qty,iif(inlist(materialid,"CJ30","CJ31","CJ32","CJ33","CJ34","CJ35","CJ36","CJ37","CJ38","CJ39","CJ40"), "2","1"))))
>	quant = val(quant)
>	replace studentid with cpack.studentid, courseid with cpack.courseid,;
>	materialid with cpack.materialid, descript with cpack.description,;
>			qty with quant for packslip.studentid == cpack.studentid and packslip.courseid == cpack.courseid in packslip
>	select packslip
>	endscan
>
>How do you think I could change this?
>
>
>Thanks,
>Tyler
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform