Mapping and Transforming Data
Variables in the scope of a rule or rule function can be mapped to arguments of a function used in that rule or rule function.
See also XPath Formula Builder for related information, as well as Working with Rules and Functions.
The Function Argument Mapper allows you to supply the data that a function expects as input. For instructions on accessing the Function Argument Mapping wizard in the rule editor see Using the Function Argument Mappng Wizard.
XPath 1.0 and XPath 2.0
TIBCO BusinessEvents supports XPath 1.0 and XPath 2.0. The default is XPath 2.0 for the new projects. TIBCO BusinessEvents uses the Standard Widget Toolkit (SWT) mapper to support XPath 2.0 and XSLT 2.0.
Using the SWT mapper for XPath 2.0, you can perform the mapping in the same way you can do for XPath 1.0; however, the mapper uses the XPath 2.0 expressions. In contrast to XPath 1.0, the type casting from one data type to another data type is not done implicitly in XPath 2.0. In XPath 2.0, you must perform the explicit typecasting using the constructor function. BusinessEvents also provides the option in the Function Argument Mapping wizard to autofix the typecasting error. You can fix the common issues using the Mapper Function Migration wizard, see Migrating Mapper Functions From XPath 1.0 to XPath 2.0 for more details on how to common mapping issues. You can also use the studio-tools utility to fix those common issues, see Migrating Mapper Functions to XPath 2.0 Using Command Line for more details.
In XPath 1.0, the mapper has two different windows the Function Argument Mapping and XPath Function Builder; however, in XPath 2.0 both window are now combined in the same Function Argument Mapping wizard. Thus, if your project uses XPath 1.0 then you will see the Function Argument Mapping wizard and XPath Formula Builder in different windows. However, if your project uses XPath 2.0 then you will see the Edit tab inside the Function Argument Mapping wizard (see Function Argument Mapping Wizard for XPath 2.0).
The mapper for XPath 1.0 had some TIBCO provided functions that were not part of the XPath 1.0 specifications, for instance format-dateTime. These functions are currently unavailable with the SWT mapper for XPath 2.0, and the old XPath expression may give error, in such case you have to manually fix those error.
All the following sections provides information on mapping data with respect to XPath 1.0 user interface; however, you can perform all those functions in XPath 2.0. For reference on the user interface for XPath 2.0, see Function Argument Mapping Wizard for XPath 2.0.
- Function Argument Mapping Wizard for XPath 1.0
Using the Function Argument Mapping wizard for XPath 1.0 you can map the source data to the input arguments of the mapper function. The wizard consists of two sections: Function and Input. - Function Argument Mapping Wizard for XPath 2.0
Using the Function Argument Mapping wizard you can map the variable of the source to the argument of a mapper function. - Mapping and Transforming Data to Function Input
- Statements Hints and Errors
When you display the Function tab, the existing statements are examined, and any input elements that do not have a statement are displayed as hints. Hints are reminders that you can specify a statement for the input element, but they are not stored as part of the XSLT template for the function’s input. Hints are displayed in italics with a light blue background. Once you specify a mapping or a formula for a hint, the input element becomes a statement. You can also drag the hint to the left past the dividing line between the panels and the hint becomes a blank statement. - Buttons Menus and Icons
The Input tab contains several toolbar buttons, popup menus, and icons. This section describes the various graphical elements of the Input tab. - Specifying Constants
For each element in the Function input schema tree, you can specify a constant. Constants can be strings or numeric values. To specify a string, enclose the string in quotes. To specify a number, type the number into the schema element’s mapping field. The following illustrates specifying the string "USA" for the Country item and 94304 for the PostalCode item of a function input schema. - Data Validation
Data passed as input to a function is validated to ensure that it conforms to its specified datatype. - Incorrect Mappings
Any incorrect statements are displayed in red in the Function panel. - Migrating Mapper Functions from XPath 1.0 to XPath 2.0
After the project is migrated from Xpath 1.0 to XPath 2.0, to fix some common mapping errors, you can use the Mapper Function Migration wizard. - Shortcuts
The Move In, Insert, Add Child, and Edit Statement buttons on the toolbar are ways to manually manipulate XSLT statements in the Function panel. These buttons, however, only add or modify one statement at a time. Also, there are some situations where you wish to convert a hint into a statement without performing any mapping. This section describes shortcuts for manipulating XSLT statements. - Examples of Mappings
Some mappings require several steps to achieve the desired results. This section describes some complicated mapping scenarios and how to achieve the desired mappings using the tools available. - XSLT Statements
Using the XSLT statement you can set up the transformation of mapping. - XPath Formula Builder For XPath 1.0
TIBCO BusinessEvents uses XPath in the XPath Formula Builder, available in the Function Argument Mapper tool. You can use XPath, for example, when defining payloads for events TIBCO BusinessEvents also uses XPath as the language for defining conditions and transformations.