This example shows how to easily transform input data into another structure.
Motivation
Suppose we have list of users (FirstName + LastName) and we have to derive a new column named FullName based on them.
Input schema
Column
Data type
FirstName
string
LastName
string
Input data
FirstName
LastName
Alice
Smith
Bob
Johnson
Ouput schema
Column
Data type
FirstName
string
LastName
string
FullName
string
JavaScript statement
varoutput=inputData.map(function(user){// transforming function applied to each input recordreturn{// returns transformed recordFirstName:user.FirstName,// copied Firstname from inputLastName:user.LastName,// copied Lastname from inputFullName:user.FirstName+''''+user.LastName// new derived property created by combination of Firstname and Lastname };});returnoutput;// returning re-mapped array