Transform uses a static parser to override some of Groovy's dynamic typing behavior and detect parsing errors, such as undefined variables, when you preview or save your transformations.
The static parser also verifies that the attributes referenced directly in your script match those defined in your data set's schema. Any attributes that don't match (for example, ones that are misspelled) produce an error.
If you include attributes as variables in your transformation scripts, the format you use for an attribute affects how it is handled by the static parser. For information about attribute formats, see Formats for variables.
If your transformation contains any parsing errors, Transform displays the resulting messages in the Transformation Error dialog box when you preview or save the transformation. Additionally, the Transformation Editor displays a red X icon next to each line that contains an error. You can hover over these icons to view more information about the error.
You should close the dialog box, fix the errors, then preview your transformation again to verify that all errors have been fixed. You cannot save your transformation to your script until it is free of errors.
These functions belong to the in-line transformations you can do in Transform. These set functions are applicable to sets of values on attributes that are multi-assign.
If you run any of these functions from Transform in Studio, and the attribute on which you attempt to run them is a single-assign (single-value) attribute, the Transform API may throw NULL or an exception, depending on the Dgraph type of the attribute.
To summarize, if you receive an exception when attempting to run a transformation, check if the attribute on which you run the transformation is a single-value. In this case, set functions do not apply.
If your transformation script contains any of the Groovy language features that are not supported, the parser throws a security exception, which is displayed in the Transformation Error dialog box. Remove the code that caused the error.
For more information on the Groovy language features that can cause security exceptions, see Unsupported Groovy language features and Reserved Keywords.
The static parser can't detect all errors, particularly runtime exceptions caused by anomalies in your data. Transform typically handles these errors by returning null values for data it can't process.
try { <transformation script> // replace this with your transformation script code 'OK' } catch (Exception ex) { ex.getMessage() }
When you preview the transformation script, any error messages it produces will be output to the temporary column of type String. Once you have debugged it, you can delete the try block and remove the temporary attribute.