Transforming source or target data
- Home
- FlightPath
- Neuron 3.7.5 Data Mapper Documentation
- Mapping Field in Data Mapper
- Transforming source or target data
When you define a mapping, you can transform any field in the mapping. Transforming a data field defines the output of that field’s data. For example, you could specify the Capitalize transformation to ensure that the first letter of a data value is uppercase.
Procedure
- Map a source and target field. This can be a one-to-one, many to one, one to many or a many to many mapping.
- In the Scriplets panel, add transformations to either the Source or Target field(s) by clicking Add Action button on the source field or target field:
- Clicking on the Action dropdown displays a list of transformation you can choose from. The list of available transformations is based on the type of either the source or target field. On the action field, you can scroll and select, or enter the name of the transformation in the action field and it shows only the transformations that matches with the text:
- Select the transformation that you want to perform. If the transformation requires any input parameters, specify them in the appropriate input fields:
- To add another transformation, click the Add Action button again on the source or target field. For E.g. In the source side, adding the Append and uppercase transformations, then adding at the target field transforming the value to lowercase again.
- To preview the data mapping results, click the Show/Hide test preview button in the Scriptlets window. This displays a text input field on the source field and a read-only result field on the target field. Enter a value in the source field’s text field, then click the Run preview test button to display the mapping result in the read-only field on the target field:
- Hide the test preview by clicking again.
Note – Test preview doesn’t support mappings between Collections and Non-collections. You can use the Test Data Mapping feature that tests the mapping of whole source documents to see the results of these mappings.
Descriptions of available transformations
The following table describes the available transformations. The date and number types refer generically to any of the various forms of these concepts. For example, number includes: integer, long, double. Date includes: date, Time, ZonedDateTime.
Transformation | Input Type | Output Type | Parameter (* = required) | Description |
AbsoluteValue | number | number | None | Returns the absolute value of a number. |
AddDays | date | date | days | Adds days to a date. The default is 0 days. |
AddSeconds | date | date | seconds | Adds seconds to a date. The default is 0 seconds. |
Append | string | string | string | Appends a string to the end of a string. The default is to append nothing. |
Camelize | string | string | None | Converts a phrase to a camelized string by removing whitespace, making the first word lowercase, and capitalizing the first letter of each subsequent word. |
Capitalize | string | string | None | Capitalizes the first character in a string. |
Ceiling | number | number | None | Returns the whole number ceiling of a number. |
Contains | any | Boolean | value | Returns true if a field contains the specified value. |
ConvertAreaUnit | number | number |
fromUnit* toUnit* | Converts a number that represents an area to another unit. For the fromUnit and toUnit parameters, select the appropriate unit from the From Unit and To Unit menus. The choices are: Square Foot, Square Meter, or Square Mile. |
ConvertDistanceUnit | number | number |
fromUnit* toUnit* | Converts a number that represents a distance to another unit. For the fromUnit and toUnit parameters, select the appropriate unit from the From Unit and To Unit menus. The choices are: Foot, Inch, Meter, Mile, or Yard. |
ConvertMassUnit | number | number |
fromUnit* toUnit* | Converts a number that represents mass to another unit. For the fromUnit and toUnit parameters, select the appropriate unit from the From Unit and To Unit menus. The choices are: Kilogram or Pound. |
ConvertVolumeUnit | number | number |
fromUnit* toUnit* | Converts a number that represents volume to another unit. For the fromUnit and toUnit parameters, select the appropriate unit from the From Unit and To Unit menus. The choices are: Cubic Foot, Cubic Meter, Gallon US Fluid, or Liter. |
CurrentDate | None | date | None | Returns the current date. |
CurrentDateTime | None | date | None | Returns the current date and time. |
CurrentTime | None | date | None | Returns the current time. |
DayOfWeek | date | number | None | Returns the day of the week (1 through 7) that corresponds to the date. |
DayOfYear | date | number | None | Returns the day of the year (1 through 366) that corresponds to the date. |
EndsWith | string | Boolean | string | Returns true if a string ends with the specified string, including case. |
Equals | any | Boolean | value | Returns true if a field is equal to the specified value, including case. |
FileExtension | string | string | None | From a string that represents a file name, returns the file extension without the dot. |
Floor | number | number | None | Returns the whole number floor of a number. |
Format | any | string | template* | In template, replaces each placeholder (such as %s) with the value of the input field and return a string that contains the result. This is similar to mechanisms that are available in programming languages such as Java and C. |
GenerateUUID | None | string | None | Creates a string that represents a random UUID. |
IndexOf | string | number | string | In a string, starting at 0, returns the first index of the specified string. Returns -1 if it is not found. |
IsNull | any | Boolean | None | Returns true if a field is null. |
LastIndexOf | string | number | string | In a string, starting at 0, return the last index of the specified string. Returns -1 if it is not found. |
Length | any | number | None | Returns the length of the field, or -1 if the field is null. |
Lowercase | string | string | None | Converts a string to lowercase. |
Normalize | string | string | None | Replaces consecutive whitespace characters with a single space and trim leading and trailing whitespace from a string. |
PadStringLeft | string | string |
padCharacter* padCount* | Inserts the character supplied in padCharacter at the beginning of a string. Do this the number of times specified in padCount. |
PadStringRight | string | string |
padCharacter* padCount* | Inserts the character supplied in padCharacter at the end of a string. Do this the number of times specified in padCount. |
Prepend | string | string | string | Prefixes string to the beginning of a string. The default is to prepend nothing. |
ReplaceAll | string | string |
match* newString | In a string, replaces all occurrences of the supplied matching string with the supplied newString. The default newString is an empty string. |
ReplaceFirst | string | string |
match* newString* | In a string, replaces the first occurrence of the specified match string with the specified newString. The default newString is an empty string. |
Round | number | number | None | Returns the rounded whole number of a number. |
SeparateByDash | string | string | None | Replaces each occurrence of whitespace, colon (:), underscore (_), plus (+), and equals (=) with a hyphen (-). |
SeparateByUnderscore | string | string | None | Replaces each occurrence of whitespace, colon (:), hyphen (-), plus (+), and equals (=) with an underscore (_). |
StartsWith | string | Boolean | string | Returns true if a string starts with the specified string (including case). |
Substring | string | string |
startIndex* endIndex | Retrieves a segment of a string from the specified inclusive startIndex to the specified exclusive endIndex. Both indexes start at zero. startIndex is inclusive. endIndex is exclusive. The default value of endIndex is the length of the string. |
SubstringAfter | string | string |
startIndex* endIndex match* | Retrieves the segment of a string after the specified match string from the specified inclusive startIndex to the specified exclusive endIndex. Both indexes start at zero. The default value of endIndex is the length of the string after the supplied match string. |
SubstringBefore | string | string |
startIndex* endIndex match* | Retrieves a segment of a string before the supplied match string from the supplied inclusive startIndex to the supplied exclusive endIndex. Both indexes start at zero. The default value of endIndex is the length of the string before the supplied match string. |
Trim | string | string | None | Trims leading and trailing whitespace from a string. |
TrimLeft | string | string | None | Trims leading whitespace from a string. |
TrimRight | string | string | None | Trims trailing whitespace from a string. |
Uppercase | string | string | None | Converts a string to uppercase. |