Pass external parameters to filter data

Top Previous Topic Next Topic  Print this topic

Overview:

Sometimes parameters are used in a document and they can change their value and need update. For parameters that often change their values, external parameters that can change their value when rendering have been implemented.

 

Solution:

This tutorial will guide users through the process of setting up a template to accept an external parameter that is passed to the template.

In this particular example, a parameter is passed to the template ($CaseNo) and then used find that information within the XML data source.

 

Step 1:  Defining the parameter

 

The user must add a parameter and specify a default value as well.  This can be completed by accessing the Parameters dialog (located under the Review Tab and Template Group) and choosing Edit.  The following screen capture demonstrates the usage of this dialog.

 

passParam1

 

 

Once this parameter is defined, the user will notice it listed within the Parameters dialog list.

 

passParam2

 

 

Step 2:  Build the template using the parameter

 

A user may desire to filter their data based on this parameter value (example:  display only the information for the element with the passed Case Number).  A user must define Conditional_sections that test the data using this parameter.

 

The user may access this defined parameter in XPath usage by using the Edit Expression dialog and selecting the Parameters secgrouption under Working Objects.  See the screen capture below demonstrating this capability.

 

passParam3

 

 

By inserting a conditional section into the document, a user can define the condition using this parameter.  An example of the XPath that may be used to successfully test this would be:

 

Condition:  /cases/case[@case-number = $CaseNo]    This section will display the desired information only for the occurrence that the parameter '$CaseNo' matches up with one of the attributes 'case-number'.

 

A default value can be specified to display an error message if the parameter is not equivalent to that specified attribute.

 

Step 3:  Rendering

 

This parameter must be successfully passed (using the same parameter name defined in the template) to the rendering engine along with the XML and XSL generated from the template.