Calculate a pattern parameter value from the values entered
for other pattern parameters.
Before you begin
Complete the following tasks:
About this task
You can transform pattern parameters by using XPath expressions;
for example, to calculate a pattern parameter value from the values
entered for other pattern parameters. IBM® App Connect Enterprise supports XPath 1.0. For XPath
reference information, including information about XPath functions,
see W3C XPath 1.0 Specification.
- The
pp:getValue()
function is included, in addition
to the functions in the XPath 1.0 Specification. The pp:getValue()
function
takes the parameter ID of a pattern parameter and returns the value
of that pattern parameter. To see the parameter ID for a pattern parameter:
- In the Pattern
Configuration tab of the
Pattern Authoring editor, double-click a parameter, or select a parameter
and click Edit. The Edit Parameter window
opens.
- Click the Transform tab. The parameter
IDs for pattern parameters are shown in the Parameter ID column
of the Pattern Parameters table.
- When a pattern instance is generated by a pattern user, transformation
expressions are processed before any Java™ and
PHP code that has been added to modify pattern instances. Transformation
of pattern parameters is processed in the following sequence:
- Every parameter that has an XPath transformation expression is
evaluated.
- The value of each parameter that has an XPath transformation expression
is updated with the result of its evaluation, overwriting the value
entered by the pattern user.
- The parameters are evaluated in top to bottom order, as they are
listed in the Pattern
Configuration tab of the
Pattern Authoring editor.
Procedure
To transform a pattern parameter by using an XPath expression:
- In the Pattern
Configuration tab of
the Pattern Authoring editor, double-click the parameter that you
want to transform, or select the parameter and click Edit.
The Edit Parameter window opens.
You cannot transform a parameter that uses a table
type.
- Click the Transform tab.
Create an XPath expression for your chosen parameter:
- To select a function:
- Expand Boolean, Number, Pattern,
or String in the Functions section, then click
a function. The function is displayed in the Function name field.
- Click Use. The function is inserted into
the Expression field at the cursor.
- To select an operator:
- Click an operator in the Operators section. The operator is displayed
in the Operator field.
- Click Use. The operator is inserted into
the Expression field at the cursor.
- To select a pattern parameter:
- Click a pattern parameter in the Pattern Parameters table.
The parameter ID shown in the Parameter ID column
of the Pattern Parameters table for the chosen parameter is displayed
in the Parameter ID field.
You
cannot select a pattern parameter that uses a table type.
- Click Use. The parameter ID is inserted
into the Expression field at the cursor.
- You can also edit the expression directly in the Expression field.
- Repeat the actions in step 2,
as required, to create your XPath expression.
- You can now choose whether to test your expression: