Complex expressions

A function parameter can be defined as a complex expression of XSLT functions. This returns the same type as the edited parameter.

To edit a function with a complex expression:

  1. Select Edit from context menu.
    The source schema elements are available in the left panel on the edit function dialog.
    The functions available in the mapper are listed in the right panel of the function dialog.
  2. Use either drag and drop, typing or code completion (see below) to insert the element and the functions into the expression configuration area.
Tip   You can use any valid XSLT function, not only the functions from the palette. Code completion is an easy way to use functions that are not in the palette.

Code completion and correction

To help you edit the parameter, click CTRL + Space to access code completion. Below is an example of code completion, offering several suggestions:

Code correction and validation

If the syntax is incorrect (for example: the expression is a string for an integer type parameter...), then the editor behaves as follows:

  • when you hover over the parameter tab, a detailed error message appears as a tooltip
  • when you hover over the function, the message of the first parameter in error appears as a tooltip
  • you can still save the expression, to correct it later

Here is a list of the some of the evaluations and verifications performed by the complex expression editor:

  • it evaluates the type of a complex expression containing functions, paths, variables or parameters and operations between them
  • it evaluates whether an expression is syntactically correct (whether it has all the corresponding parenthesis, for example)
  • it detects when the expression uses a function which is not supported (such as typos in the function name)
  • in a function, it detects when the number of parameters is inconsistent with the function signature
  • in a function, it detects when the parameter types are inconsistent with the function signature

Complex expression example

For example, if you want to transform the string 1937-06-01T10:45:03' into '19370601 you could use: substring(translate(translate(translate($value,'T',''),'-',''),':',''),1,8).

Visual Mapper transformation of the substring

In this example, the string is converted in the value argument by replacing all characters in string1 with the characters in string2. If string2 was empty, the characters defined with string1 are deleted in the result signature: translate(value : string, string1 : string, string2 : string) : string

Visual Mapper transformation of the substring

Visual Mapper transformation of the substring from the source element

 

Related Links