Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating Variables in a SCAN
Message
 
 
To
14/01/2009 22:55:08
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01373889
Message ID:
01373895
Views:
20
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform