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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

& replacement 2

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
CA
Hi,

I have a calculation routine which get its data from a view
called tmp_step. I want to make the procedure more generic.

lnRatio(1)=tmp_step.m40_39
lnRatio(2)=tmp_step.m36_39
lnRatio(3)=tmp_step.m37_39
lnRatio(4)=tmp_step.m38_39
etc...

For example, so that it can get data from either ar_step and tmp_step.
I know I can use & to replace a command

lsField=tmp_step.m40_39
lnRatio(1)=&lsField
lsField=tmp_step.m36_39
lnRatio(2)=&lsField
lsField=tmp_step.m37_39
lnRatio(3)=&lsField
lsField=tmp_step.m38_39
lnRatio(4)=&lsField
etc...

But this can lead to very long code.

Is there a way I can only replace the table name

I tried

lsTable="tmp_step"
lsRatio(1)=&lsTable+".m40_39"
etc...

but couldn't get it to work. Anybody have a suggestion?

Thanks for your help.

Linda
 
Hi,

How about using the EVAL() function?

lsField_In_DBF1 ="tmp_DBF1.m40_01"
lsField_In_DBF2 ="tmp_DBF2.m40_01"

lsRatio(1)=eval(lsField_In_DBF1)
lsRatio(2)=eval(lsField_In_DBF2)

I think that might work for you,
msc
 
Linda,

try
Code:
lsTable="tmp_step"
lsRatio(1)=&lsTable..m40_39

be sure to use 2 periods. the first ends the macro substitution.


 
Thank you all for taking the time to answer.

Madtown, your reply solved my problem.

Linda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top