Skip to content

Transform using javascript

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.

Input

  • Data – Required
    A table of input data that will be transformed using JavaScript expressions.

Output

Output TypeFormatDescription
DataTabularData after JavaScript-based transformation.

Configuration Fields

Field NameDescription
Column MapRequired. A mapping of output column names to JavaScript expressions. Expressions can access other column values using JavaScript syntax.
Include OriginalOptional. If enabled, original input columns are retained in the output. Otherwise, only the transformed columns are returned.

Sample Input

EmployeeIDNameDepartmentSalaryJoinDateSecretCode
101John DoeHR500002020-01-151234abcd
102Jane SmithIT700002019-03-105678efgh
103Alice JohnsonFinance600002021-06-259101ijkl
104Bob WilliamsMarketing550002018-09-121213mnop
105Emma BrownSales650002022-02-201415qrst

Sample Configuration

FieldValue
Column Map{ "Experience": "(new Date()).getFullYear() - new Date(JoinDate).getFullYear()" }
Include Originaltrue

Sample Output

EmployeeIDNameDepartmentSalaryJoinDateSecretCodeExperience
101John DoeHR500002020-01-151234abcd5
102Jane SmithIT700002019-03-105678efgh5
103Alice JohnsonFinance600002021-06-259101ijkl3
104Bob WilliamsMarketing550002018-09-121213mnop6
105Emma BrownSales650002022-02-201415qrst2