Advanced Transformer code editor
The Advanced Transformer is used for per-event transformations. It processes individual events independently, performing 1 to 1, many or none It is stateless unless state handling is explicitly implemented.
Example
If you receive a record with a price stored as text, like "25", you can convert it into a number (25) and add a new field, such as totalAmount = price * quantity.
exports.step = function(payload) {
// Convert price from text to number
const price = Number(payload.price);
const quantity = payload.quantity || 0;
// Add a calculated field
const newPayload = {
...payload,
price: price, // Converted to number
totalAmount: price * quantity, // New calculated field
status: "transformed" // Example of adding a new field
};
return newPayload;
}
Capabilities
The Advanced Transformer code editor can be used to handle one record or event at a time. You can use it to change or update data fields, like renaming them or adding new ones. It is also useful for checking and cleaning data. For example, making sure each record has valid values. You can perform simple math or formatting changes, such as converting numbers to text or calculating totals for that single record.It lets you customize how each event looks and behaves before it moves further in the process.
The Advanced Transformer code editor works only with one event at a time. It does not remember what came before or what comes next. That means you cannot compare multiple events, combine data from several records, or analyze data over time. It also does not store any information between events. It is stateless and treats each record as new.