Transformation functions
Overview
Bizagi offers a set of comprehensive functions for the mapping of parameters in Web-based services invocations (both input and output parameters).
Such functions are helpful to interpret and perform manipulation of information, especially commonly used in XML transformations.
Furthermore, Bizagi provides functions to import and export the built mapping.
Special functions
Using of the special functions requires that the mapped fields must be inside of an Element node.
Note:
Consider the following aspects when using these functions:
- Element nodes can be seen as complex-type elements.
- Special functions require that their input and output are contained in element nodes.
- Not all functions are available for every web service configuration (i.e, while using a SOAP 1.1 based service port, some functions will not be presented).
Functions
Concatenate
This function concatenates two or more input (string type) into a single output (string type). A common example considering concatenation of a contact's first name and last name illustrates this function's use and reach:
To use this function, select from the functions (fx) bar, the Concat option located in the string category functions menu. Then, drag and drop this option into the main mapping window where your tables are.
You may now drag and drop the input's outgoing connection triangle into the Concat box as a parameter (param1).
Repeat this step for the input you choose as param2.
Finally, select the Out line in the Concat box to define the output for the concatenation function.
Notice you may still concatenate more fields by including more Concat function boxes (as a cascade). This way, the output of a Concat function can be used as input for another Concat function to append a third parameter (in this case).
Substring
This function obtains a string that is a substring of the original string.
Take into account that this special function in Bizagi does not require that its input is a string field. Bizagi will automatically convert other data types such as Integer or DateTime into a string. This allows the use of the Substring function with any other data type different from a string.
To use this function, select from the functions (fx) bar, the Substring option located in the string category functions menu. Then, drag and drop this option into the main mapping window where your tables are:
You may now drag and drop the input's outgoing connection triangle into the Substring box as the "string" parameter (this is the original input string which is mandatory).
For the other two parameters, the function expects a number which indicates:
- Start parameter: the starting position in the original string from which the desired substring will be obtained. This parameter is mandatory.
The first character and starting position of the original string is always 1.
- Length parameter: the number of characters included from the starting position.
The length parameter is optional (specifying no length will include all the characters from the starting position to the end of the original string).
A common example is to use the Substring function to extract specific information from a DateTime value, such as the year, month, and day:
Constant
This function inserts a definition of a constant value (string or number) into your mapping schema so that it can be used to set a default value into a field.
For example, suppose that five days are always updated as available vacation days when a new employee is registered.
You may now drag and drop the constant box outgoing connection triangle into the desired target field for your input mapping.
Format Date
This function transforms a date into a string according to the selected format.
To use this function, select from the functions (fx) bar, the Format Date option located in the Utilities category functions menu.
You may choose any of these options:
-
Generate output with date: Includes the date in a specific format.
- Default short date format
- Default long date format
- Another format (list of common date formats)
-
Generate output with time: Includes the time in a specific format.
-
Custom format: Allows you to add a custom date format.
Select the Date and Time format options as desired.
You may now drag and drop into the desired target field into your input or output mapping.
Note:
The Format Date function always receives a date and returns a string.
Example
1. Date only in format dd/MM/yyyy (e.g., June 24th, 2016 → 24/06/2016)
Result:
2. Full Date and Time with time zone offset (yyyy-MM-ddtHH:mm:ssz)
For example, June 24th, 2016, 08:42:05 am in UTC-5 → 2016-06-04a08:42:05-5
Result:
Export Mapping
Bizagi allows you to export the current mapping into an XML file to encourage reusability.
Select the path where the XML file will be saved and give it a name, then click Save.
Import Mapping
Bizagi allows you to import a previously saved mapping from an XML file.
Select the XML file and click Open.
Note:
- If a mapped attribute is not found when importing, it will be ignored.
- The mapped attribute's name has to be the same. If they are different, they will be ignored.