Description
The Transform using JavaScript activity allows users to apply custom logic to tabular data using inline JavaScript expressions. This is useful for deriving new columns, masking or obfuscating values, formatting fields, calculating metrics, or cleaning up inconsistencies.
JavaScript expressions are configured for each target column and can access other column values from the same row. This activity provides flexibility for use cases where native transformations are insufficient.
Use case:
You can calculate employee experience from the JoinDate column, obfuscate sensitive columns like passwords or account numbers, or create conditional outputs based on department or salary ranges.
- Data – Required
A table of input data that will be transformed using JavaScript expressions.
Output
Output Type | Format | Description |
---|
Data | Tabular | Data after JavaScript-based transformation. |
Configuration Fields
Field Name | Description |
---|
Column Map | Required. A mapping of output column names to JavaScript expressions. Expressions can access other column values using JavaScript syntax. |
Include Original | Optional. If enabled, original input columns are retained in the output. Otherwise, only the transformed columns are returned. |
EmployeeID | Name | Department | Salary | JoinDate | SecretCode |
---|
101 | John Doe | HR | 50000 | 2020-01-15 | 1234abcd |
102 | Jane Smith | IT | 70000 | 2019-03-10 | 5678efgh |
103 | Alice Johnson | Finance | 60000 | 2021-06-25 | 9101ijkl |
104 | Bob Williams | Marketing | 55000 | 2018-09-12 | 1213mnop |
105 | Emma Brown | Sales | 65000 | 2022-02-20 | 1415qrst |
Sample Configuration
Field | Value |
---|
Column Map | { "Experience": "(new Date()).getFullYear() - new Date(JoinDate).getFullYear()" } |
Include Original | true |
Sample Output
EmployeeID | Name | Department | Salary | JoinDate | SecretCode | Experience |
---|
101 | John Doe | HR | 50000 | 2020-01-15 | 1234abcd | 5 |
102 | Jane Smith | IT | 70000 | 2019-03-10 | 5678efgh | 5 |
103 | Alice Johnson | Finance | 60000 | 2021-06-25 | 9101ijkl | 3 |
104 | Bob Williams | Marketing | 55000 | 2018-09-12 | 1213mnop | 6 |
105 | Emma Brown | Sales | 65000 | 2022-02-20 | 1415qrst | 2 |