Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable substitution of two variables?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00188161
Message ID:
00188164
Views:
24
Christian,
Try:

>LPARAMETERS mVar1, mVar2, mVar3
>LOCAL lcDir1
>lcDir1 = CURDIR() &&for example
>mCnt = PCOUNT()
>FOR i = 1 TO mCnt
> IF FILE(m.lcDir1 + EVAL("mVar" + ALLT(STR(i))) + ".DBF") && variable mVar not found!
> && Do something
> ENDIF
>ENDFOR

HTH!
Mark


>Hello,
>I'm trying to make a generic code like this, where parameters should be evaluated as following:
>
>LPARAMETERS mVar1, mVar2, mVar3
>LOCAL lcDir1
>lcDir1 = CURDIR() &&for example
>mCnt = PCOUNT()
>FOR i = 1 TO mCnt
> IF FILE(m.lcDir1 + (mVar + i) + ".DBF") && variable mVar not found!
> && Do something
> ENDIF
>ENDFOR
>
>Of course, this does not function.
>Is there a way to work like this? This would save me much work!
>Thank you for your time!
"It hit an iceberg and it sank. Get over it."
Robert Ballard, dicoverer of the Titanic wreckage.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform