Hi Sergey,
I know that in THAT case I do not need macro substitution, but I used that just as an example. In reality, the value in getfield will change to a different field name and the wordhide program will pull the value from the correct field in the table
depending on the fieldname that is passed to it. So I need to use macro substitution so I can use
one variable name: getfield throughout a procedure and only change the field name ONCE and store it in the variable getfield.
getfield='prof_sc'
value1 = WORDHIDE(&getfield)
?value1
FUNCTION wordhide
PARAMETERS xstr
set step on
? xstr
IF LOWER(xstr)='prof_sc'
RETURN 'mdr_dob'
ELSE
RETURN 'unknown - prof_sc was not passed to this program'
ENDIF
>Tracy,
>
>You don't need macro substitution in this case.
getfield='prof_sc'
>value1 = WORDHIDE(getfield)
>?value1
>
>>I want to dynamically send the value from a field to a function where the fieldname may change depending on different conditions. For instance, if the table is al3dict.dbf and the field value I want to pass is al3dict.prof_sc which contains the character string mdr_dob, I try:
>>
>>
>>*Original Code Works Correctly
>>value1=WORDHIDE('prof_sc')
>>?value1
>>
>>*New code using macro substitution does not work, why?
>>getfield='prof_sc'
>>value1 = WORDHIDE(&getfield)
>>?value1
>>
>>
>>WORDHIDE
should return the string 'mdr_dob' but in fact it doesn't appear that the wordhide program is running at all once I use macro substitution. I placed a 'set step on' in the top of the wordhide program and it never hits it. I have deleted all .bak and .fxp versions of the wordhide program to ensure that it could not be attempting to run an older version.
>>
>>Any ideas?
>>TIA!
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"