<call>
The <call>
element allows you to place a
<block>
of Macro Language code into the Macro Language query you are
currently working in, but not access the encapsulating <block>
's
variables.
Description
The <call>
element inserts a <block>
of Macro
Language at the location in the query where the <call>
element appears.
<call>
can be used in the context of a <block>
.
When <call>
is used to reference a <block>
, the
<block>
being called has no access to the encapsulating
<block>
's variables or values.
If you want access to the encapsulating <block>
's variables or values,
use <insert>
instead of <call>
. If you want to be
able to both access and modify the encapsulating <block>
's variables,
use <expand>
.
Syntax
<call block="[NAME_OF_BLOCK]" [[VAR_1]="[VALUE_1]" [VAR_2]="[VALUE_2]"... [VAR_N]="[VALUE_N]"]/>
Attributes
block
- Specifies the
<block>
(code and defined variables) to insert into the current query.
The <call>
element may take any number of additional attributes, which
should match the attributes in the <block>
opening tag that defines the
called <block>
. The [VALUE] of a
[VAR]="[VALUE]" attribute is substituted wherever
{@[VAR]}
appears within the called
<block>
.
Example
In this example, the base table is pub.demo.retail.item
.
<base table="pub.demo.retail.item"/> <library> <block name="storeSelection" storechoice=""> <sel value="store={@storechoice}"/> </block> </library> <call block="storeSelection" storechoice="3"/>
At the location of the <call>
statement, the
<block>
named storeSelection
is expanded using the
storechoice
attribute, and the value for storechoice
(3)
is substituted for {@storechoice}
within the <block>
,
effectively resulting in the following operation:
<sel value="store=3"/>