Variable substitution.

bmwisme

New Member
Can someone tell me if Progress has what I know as MACRO substitution. Here is the explanation per Visual FoxPro:

You can replace names with variables by using macro substitution. To use macro substitution, place an ampersand (&) before the variable to tell Visual FoxPro to use the value of the variable as a name, and use a period (.) to end the macro substitution expression.
For example, the following print statement produces “FoxPro”:

x = "Fox"
? "&x.Pro" <-------- "?" is print to screen.

I am wanting to do something similar in Progress. Example below:

***********************************************
MyString = "By credit-limit"

Instead of...
FOR EACH customer BY credit-limit:

Use variable...
FOR EACH customer MyString:
***********************************************

I know that I could use &GLOBAL-DEFINE but this is pre-processor substitution and I need to dynamically define the "MyString" based on some runtime event.

Thanks in advance...

Bill Wester
RoBAND Corporation
 

Cabral

New Member
Hi Bill,

I have problem as a your problem to.
You can´t do this with progress.

If your finish user use full progress, then you can make a dynamically program compile and run it in your main program.

Like this.

/********
***Main Program
*********/
define variable mystring as char format "x(50)".

update mystring.

output to "c:\temp\foreach.p".

put "for each customer BY " + mystring + ":" skip
" disp customer.cust-num." skip
"end." skip.
output close.

compile c:\temp\foreach.p ATTR-SPACE SAVE INTO c:\temp.

run c:\temp\foreach.p.

/********
*** end Main Program
*********/

If you needs more help send me a mail.

Kind Regards,
Cabral.
cabral_rodrigo@hotmail.com
CSI - Consulting - São Paulo - SP - Brazil - America do Sul
 
Top