Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating Variables in a SCAN
Message
 
 
À
14/01/2009 22:55:08
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01373889
Message ID:
01373895
Vues:
12
>>>I want to create as many variables as there are records in the table and assign them a value that is a field in the table. So, I want to end up with something like this:
>>>
>>>Cpt1 = "This is one"
>>>Cpt2 = "This is two"
>>>
>>>This is the simple SCAN I want to work it in:
>>
>>See inside from the top of my head.
>>
>>
>>local lcVarName 
>>	ix = 1
>>	SCAN
>>		* Make a variable based on m.ix like "Cpt1" then "Cpt2" etc, and assign them a value from the table until the scan is done.
>>                                         lcVarName = "cpt" + transform(m.ix)
>>                                          local &lcVarName
>>                                          store myField to ("m." + lcVarName)
>>		ix = m.ix + 1
>>
>>	ENDSCAN
>>
>
>Why the LOCAL?

This is how I understood the requirement. If you don't use LOCAL (comment this line out), the variables would be created private by default.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform