After the document specification is loaded, you can iterate
the templates and the variables for each template. The variables for
a template are available in the RPETemplate.getVariables() collection.
After you have identified the variables, you can modify the variable
properties as needed.
The example shows modifying the value of the variable named
DocumentName.
The variable is searched in all templates from the document specification.
To restrict the search, verify the path property of the template.
For (RPETemplate template : docspec.getRuntime().getTemplates())
{
String templatePath = PropertyUtils.getPropertyRawValue( template.getProperty(RPEConfigConstants.PROPERTY_PATH), "");
for ( RPEVariable var : template.getVariables())
{
String varName = PropertyUtils.getPropertyRawValue( var.getProperty(RPEConfigConstants.PROPERTY_NAME), "");
if ( varName.equals("DocumentName"))
{
var.setValue( new Value( null, "RPE Sample"));
}
}
}
Note: You can also configure the variables from a template
as you add the template to the document specification.