Writing Transformation Scripts
Use the Script option in the transformation editor to create scripts that consist of statements.
Each script has a text-based, statement-oriented syntax. Scripts allow you to run statements, which operate on one dataset at a time. Each statement produces a new dataset from the current dataset. Statements may change the shape of the dataset. Statements can be composed of expressions, which operate on attributes of the dataset.
The following example shows a simple script:

Best Practices for Writing Scripts
These suggestions can help make your scripts easier to read and collaborate on.
- Begin every script with a brief comment that describes the goal of the script. To indicate a comment, start the line with
//
. - When defining your unified dataset, use a consistent format for attribute names. For example, always use "camelCase" or "snake_case".
- in
SELECT
statementS, include a line break after eachAS attribute_name
. - When writing nested transformations, consider using tabs to indent and visually divide the script into sections.
Tips
- To view long scripts, expand the script box to open a larger editing area. To go back to the original area, choose Collapse.
- To comment or uncomment lines of code, use Cmd+/ (Mac) or Ctrl+/ (Windows).
- To view an attribute's data type, move your mouse cursor over the attribute name.
- To view a function's signature, move your mouse cursor over the function name.
- To learn how to use a function, Cmd+click (Mac) or Ctrl+click (Windows) on the function name to open a description in a new browser tab.

Updated over 4 years ago