Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variable value to other variable

Status
Not open for further replies.

imemoje

Programmer
Jan 22, 2008
11
BA
First I'm sorry for my bad english

Is there a way to pass value from one variable or field to other variable, like

VAR1='This is a string'
VAR2=99

Entry local variable UNOS STRING(10)

When I enter a value 'VAR1' in UNOS

Message(%UNOS) need to say 'This is a string'

Otherwise entering 'VAR2'

Message(%UNOS) need to say 99


Or something like that

regards,
 
Simply you can do this

Code:
VAR1='This is a string'
!enter value 'VAR1' in UNOS
UNOS = 'var1'
BIND('var1',var1)
message(evaluate(UNOS))

Regards
 
Thanks for your reply

I'm not sure I explained the problem well:

I have something like
BAZ: Value1 = 123
BAZ: value2 = 456
BAZ: Value3 = 789

At second base will keep the field name

DDT: val1 = 'BAZ: Value1'
DDT: val2 = 'BAZ: Value2'
DDT: Val3 = 'BAZ: Value3'

Is there a way to tell if

ISM# = DDT: val1

I get the value

ISM#=123

(DDT:val1 = BAZ:Value1 = 123)

PS.Since I have previously worked in the Clipper to be there, it looked like this
ISM# = &DDT:val1

regards,
 
Thats what I said , but you have to bind the BAZ:Value1.. etc before using evaluate function. It is exactly like clipper's &.


Hope you got my point.

Regards
 
In your example

Code:
BAZ:Value1 = 123
DDT:val1 = 'BAZ:Value1'

BIND('BAZ:Value1',BAZ:Value1)

ISM# = evaluate(DDT: val1)

p.s : remove the spaces after : in your variables

Regards


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top