Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Macro Definition Problem

Former Member
0 Kudos
100

How do I pass the <i><b>contents</b></i> of a field to a macro rather than the field name itself?

For example in the SUBT macro below, I want to pass the VALUE of setnode-subsetname to the SUBTOTAL macro, not the field name itself

DEFINE SUBT.

select * from setnode

where setclass = '0101'

and subclass = 'AAAA'.

and SETNAME = '&1'.

SUBTOTAL <b>setnode-subsetname</b> &1.

endselect.

END-OF-DEFINITION

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos
34

Parameters can be accessed with &. You don't need to use the single quotes.

DEFINE SUBT.

select * from setnode 
where setclass = '0101'
and subclass = 'AAAA'.
and SETNAME = &1.   " << &1 without quotes

SUBTOTAL setnode-subsetname &1.

endselect.

END-OF-DEFINITION

Use of macro:

SUBT 'TEST40'.

Regards,

Naimesh Patel

1 REPLY 1

naimesh_patel
Active Contributor
0 Kudos
35

Parameters can be accessed with &. You don't need to use the single quotes.

DEFINE SUBT.

select * from setnode 
where setclass = '0101'
and subclass = 'AAAA'.
and SETNAME = &1.   " << &1 without quotes

SUBTOTAL setnode-subsetname &1.

endselect.

END-OF-DEFINITION

Use of macro:

SUBT 'TEST40'.

Regards,

Naimesh Patel