Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro substitution
Message
 
To
08/04/1998 13:15:24
Raul Davila
Davila Programming Services
Toa Alta, Puerto Rico
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00090513
Message ID:
00090559
Views:
23
Raul,

I don't think you understand what the period delimiter does. Basically, it tells the interpeter that it should append whatever is after the . to the end of the value of the variable that you substituted.

var_value=5
x='var'
? &x._value

The ? line is the same as doing:
?var_value

The interpreter just changes the x to var, then appends the _value to it.

>Hi:
>
> The help file shows the following for the & command:
>
> & Command
> Performs macro substitution.
>
> Syntax
> & VarName[.cExpression]
>
> Arguments
> & VarName Specifies the name of the variable or array element
> to reference in the macro substitution.
>
> .cExpression The optional period (.) delimiter and .cExpression
> are used to append additional characters to a macro.
> cExpression appended to the macro with .cExpression
> can also be a macro.
>
>Given that explanation one of the following should work:
>
> var_value = 5
> var_name = 'var_value'
>
> output_var = &var.'_name'
> .OR.
> output_var = &var._name
> .OR.
> cEXPR = '_name'
> output_var = &var.eEXPR
> .OR.
> cEXPR = '_name'
> output_var = &var.&eEXPR
> .OR.
> cEXPR = '_name'
> output_var = &var.(eEXPR)
>All of those are supposed to append "_name" to &var thus making &var_name.
>Needless to say, none of them work.
>
>The only usage I've found is:
> var_value = 5
> var_name = 'var_value'
> output_var = &varname
>This is a very limited usage since it's too "strict"
>
>Does anybody know the right way to do this?
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform