Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro Substitution Fails
Message
From
18/03/2003 15:51:55
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00767234
Message ID:
00767252
Views:
13
Hi Sergey,
I have a function that unencrypts the value stored in a field in a table. The function is used universally throughout the app and to do so, I need to pass it the field name so it knows which field's value to decrypt/encrypt. So I want to be able to store the fieldname in a variable and pass the value in the variable to it using the variable throughout the app.

I got it working though using EVALUATE(). I always forget about the EVAL() function!

>I guess I'm missing something but I still don't see why you would need macro substitution.
>
>>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
>>
>>*wordhide function xstr param should = 'prof_sc' in this example only
>>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
>>
.·*´¨)
.·`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"
Previous
Reply
Map
View

Click here to load this message in the networking platform