Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of macro substitution vs. string valued variables
Message
From
22/07/1999 23:33:59
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
 
To
22/07/1999 15:49:48
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00244254
Message ID:
00245157
Views:
16
>>>One useful thing for the macros I found was for calling a procedure whose name is in a table, or calculated somehow - like when I calculated interest using several methods, and calling calc01, calc02, calc03 routines, and, you may guess, the table contained "01", "03" and such in the UseMethod field. Then I calculated the factor like this:
>>>
>>>lcMeth=table.UseMethod
>>>lnCoeff=calc&lcMeth()
>
>>You still don't need macros to do this- you can use EVAL instead.
>>
>>lcMeth= "calc." + ALLTRIM(table.UseMethod) + "()"
>>>lnCoeff=EVAL(lcMeth)
>>
>>Faster, and IMHO, better.
>
>Agreed. Nowadays I also use Eval() wherever possible - though there are some soft spots left for the &.

Yep. About the only time you *really* need a macro is when commands are involved.
David.
Previous
Reply
Map
View

Click here to load this message in the networking platform