Mapping Constants and Using Functions
- Home
- FlightPath
- Neuron 3.7.5 Data Mapper Documentation
- Mapping Field in Data Mapper
- Mapping Constants and Using Functions
A common scenario in data mapping includes a target field that requires a constant or generated value, but no source field to map from. For example, a target Boolean field that always needs to be set to true, or a target date/time field that needs to be set to the current date/time when the mapping occurs. The Data Mapper provides you the ability to define constants or execute simple functions to use as source values.
Creating Constants
At the top of the Source(s) panel, to the right of Constants/Functions, click the + sign to display the Create Property dialog:
- Set the type to Constant.
- Select the property’s value type. This is used when defining mappings to target fields.
- Enter a value for the constant. This value must be the same type that is selected in the Value Type list.
- Click the Save button.
Note: You cannot give a constant a name. It is displayed with its value followed by the type in parenthesis (i.e. true (BOOLEAN)). You can map the same constant to multiple target fields.
Note: You must enter a value for the constant. If you require an empty string or null value, use a function instead.
Using Functions
At the top of the Source(s) panel, to the right of Constants/Functions, click the + sign to display the Create Property dialog:
- Set the type to Function.
- Select which function to execute from the Function Name list.
- Click the Save button.
Note: You cannot give a function a name. It is displayed using the function’s name and type in parenthesis (i.e. CurrentDateTime (DATE_TIME)). You can map the same function to multiple target fields.
Supported source functions
Function | Output Type | Description |
GenerateUUID | String | Generates a random UUID |
CurrentDate | Date | The current date as yyyy-MM-dd |
CurrentUtcDate | Date | The current UTC date as yyyy-MM-dd |
CurrentDateTime | Date Time | The current date-time as yyyy-MM-ddTHH:mm:ss.fff |
CurrentUtcDateTime | Date Time | The current UTC date-time as yyyy-MM-ddTHH:mm:ss.fffZ |
CurrentTime | Time | The current time as HH:mm:ss.fff |
CurrentUtcTime | Time | The current UTC time as HH:mm:ss.fff |
EmptyString | String | The target node will have a string value of “” |
NullValue | String | The target node will have a null value |