Using Parameters in Subdocuments

Top Previous Topic Next Topic  Print this topic

Just like document templates, individual Subdocuments can also accept parameters passed to them. If you are creating, inserting, or changing a Subdocument you will have the option to configure parameters. Use the steps provided below to accomplish this.

 

1. In the change, insert, or create Subdocument Dialog, select Manage parameters. From the Parameters Dialog select the Add Parameters button.

 

param1

Figure 1: The Add parameter button highlighted in the Parameters Dialog.

 

2. A menu will now be displayed. Specify the name of the parameter. You can now specify the default value of the parameter that will be passed to the Subdocument or you can select Switch to Dynamic to select a dynamic value from your XML Data Source. You can repeat this process to add as many parameters that you would like. Select Apply then Insert when you have finished.

 

param2

Figure 2: The parameter name and value is specified.

 

3. Next, ensure that your Subdocument is set up to accept the parameter. Open the Subdocument for editing in another window. Select the Developer Tab in the Ribbon and choose Manage Parameters. The Developer Tab is an option that you can enable from the File Tab.

 

param3

Figure 3: The Parameters Dialog as opened from the Developer Tab.

 

4. Select Add New Parameter. Add the same name previously configured and a default value as desired. Select Save when you are finished.

 

5. Now, you can use this parameter in your Subdocument. Select Field from the Insert Tab.

 

6. In the Insert Field Dialog, select Create expression from the Advanced Group.

 

7. In the Create Expression Dialog, select Add a Parameter.

 

param6

Figure 4: The Add a Parameter option is selected.

 

8. Select your parameter from the list of available parameters. Then select Save to insert your parameter.

 

param7

Figure 5: The data parameter is selected in the available parameters list.

 

9. The parameter will now be displayed in the Design Surface as a field. Save your work in the Subdocument and return to the document template. Make sure to refresh your subdocument so the edits you made will be present.

 

param8

Figure 6: The parameter is present in the Design Surface.

 

10. It is now time to preview your output to ensure your parameter is behaving as intended. In our example, the parameter value defined in the template "June 20th, 2016" will now be passed to the Subdocument and will overwrite the parameter defined in the Subdocument. The result of the output should show this value populated.

 

param9

Figure 7: The parameter is passed to the Subdocument and used appropriately.