Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Contents |
Prev | Next |
Call Templates From Templates
Using function calls with parameters, you can call templates from other templates, whether standard templates or user-defined templates created within your project. Also, called templates can return a value, and can be called recursively.
Examples
A call statement returning a parameter to a variable:
$sSource = %StateEnumeratedName($Source)%
A call statement to a template that has parameters:
%RuleTask($GUID, $index)%
Using the $parameter statement in the called template:
$GUID = $parameter1
$index = $parameter2
Templates support recursive calls, such as this recursive call on the template RuleTask:
$GUID = $parameter1
$index = $parameter2
% PI = "" %
$nul = "Initialize condition and action object"
$count = %BR_GET("RuletCount")%
% if $count == "" or $count == $index %
%ComputeRulet($GUID)%
\n
% endTemplate %
%Rulet($index)%
\n
$index = %MATH_ADD($index, "1")%
%RuleTask($GUID, $index)%
Learn more