Calling Sub-Projects (parameters)
To follow along, download the following project files (4) and place them in the Minisoft\eFORMz_6\projects\Sample folder:
When you pass parameters to a sub-project, they can be accessed in that sub-project by defining Data Node variables as follows:
1. If the calling project does NOT pass XML as Input Data to the sub-project, then the variables are defined as Data Node variables with the following value for “Data Node”:
Parameters/<Parameter1Name> Parameters/<Parameter2Name>
2. If the calling project passes XML as Input Data to the sub-project, then the Data Node value is prefixed “VariableValues/”, like this:
VariableValues/Parameters/<Parameter1Name> VariableValues/Parameters/<Parameter2Name>
XML Input Data
The first pair of projects demonstrate how to access parameters in a sub-project when the Input Data is XML.
CallSubProjectXMLDataAndParameters.efz
Define an XML variable (XMLSomeData), and pass this to a sub-project along with two additional parameters: FormSize and Orientation. Define the “Input format” as XML and the “Character set” as UTF-8.
SubProjectXMLDataAndParameters.efz
In the sub-project, define the two parameters as Data Node variables, with the Data Node value of “VariableValues/Parameters/” followed by the name of the parameter as passed from the calling project, “FormSize” in this example:
You can verify the variables are defined correctly in the sub-project if the parent project’s output looks like this (the sub-project echoes the parameter names and values in a rule):
Non-XML Input Data
The second pair of projects demonstrates how to access parameters in a sub-project when the Input Data is anything other than XML.
CallSubProjectNonXMLDataAndParameters.efz
Define two variables to pass to the sub-project: Form and Orientation, and give them the values “4×6” and “portrait”, respectively. Call the sub-project from a rule, where the rule variable is the system variable “N/A”, which is just an empty string (definitely not XML):
SubProjectNonXMLDataAndParameters.efz
In the sub-project, define the incoming parameters as Data Node variables, with the Data Node value of “Parameters/” followed by the name of the parameter as passed from the calling project, “FormSize” in this example:
You can verify the variables are defined correctly in the sub-project if the parent project’s output looks like this (the sub-project echoes the parameter names and values in a rule):