Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cycling through fields
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00434894
Message ID:
00434986
Views:
17
Hi Nick,
local i, younumber, lRetValue
for i=1 to yournumber
  lRetValue=evaluate('test.'+'spam'+transform(i)
next
BTW, make sure to use < pre > and < /pre > tags to outline your code correctly.

Hope this helps.

Michelle, cc to you, because evaluate is better, than macro expansion.

>I have 4 fields (actually 15 but I'm keeping it down to 4 for this example). They are name the following:
>
>
>test.spam1
>test.spam2
>test.spam3
>test.spam4
>
>in my for loop I want to cycle through these fields and based on which loop number I arrive at, I need to get information from the correct field.
>
>for a = 1 to 4
> z = test.spam?
>endif
>
>my problem is how do attach the right field number to the end of test.spam? so that I can retrieve correct infomation from field. For example if a = 2 then I want to give 'z' the value of test.spam2. if a = 4 then 'z' should equal the value of test.spam4. Help appreciated.
>
>thank you
>nick patel
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