There might be a scenario where you want to share a variable value across templates within a document specification. This is not supported directly using RPE template variable. However this could be achieved using Java system variable.
Note: Once the Java system variable is set, the variable value is available during future document generation until RPE Launcher / Studio is restarted. Hence, make sure to reset such variable value at the beginning of the template to avoid unnecessary results.
During concurrent document generation, if same variable name is used, it could result in inconsistent value. Hence, create a very unique variable name for using across document specifications. You could log (using _sessionLogger) the variable value before using them for printing.Set the variable “myVar” to a value in template 1.
java.lang.System.setProperty(“myVar”, “Setting the variable value in Template 1”);
Read variable value in template 2
Create a document specification that includes template 1 first and then template 2. Generating the document will print the following.
Read value set in template 1: Setting the variable value in Template 1