Macro Substitution

rpenridge

New Member
Pre-Processor Question

Hi All,

I want to build a for each loop that let's the user choose the field order of the break by statement. How can I do this? I thought about using the pre-processor to do it but can't get it to work...

if choice = "Product Line" then do:
&scoped-define str pt_prod_line
end.
else do:
&scoped-define str pt_part
end.

for each pt_mstr no-lock by {&str} :
display {&str} .
end.

This won't work because str will always end up being defined as pt_part (obviously), but it gives you an idea of what I am trying to do.

Thanks,
Rob
 

rpenridge

New Member
yeah - i have read on other posts that v9 has dynamic queries that let you do that, but i am running v8.3 with no chance of upgrading to v9 for quite some time... is there any way to do this without using dynamic queries?

rob
 

MurrayH

Member
Um .. maybe .. call a different ".p" or internal procedure one with the first query and the second with the other

eg.

if type = 1 then run a.p else run b.p

maybe return a temp-table?? I'd say upgrade to v9.

Murray
 
U

Unregistered

Guest
You should forget about doing dynamic query with progress 8.3b...it's really too much effort !!
 

kidlat

New Member
try this one w/ include file:

if choice = "Product Line" then do:
{a.i &str pt_prod_line}
end.
else do:
{a.i &str pt_part}
end.


/*program: a.i */
for each pt_mstr no-lock by {&str} :
display {&str} .
end.
 

kidlat

New Member
oops sorry i forgot to put "=" sign.

try this one w/ include file:

if choice = "Product Line" then do:
{a.i &str="pt_prod_line"}
end.
else do:
{a.i &str="pt_part"}
end.


/*program: a.i */
for each pt_mstr no-lock by {&str} :
display {&str} .
end.
 
Top