You can add a new attribute to a project data set by specifying
Groovy code to produce the attribute and by specifying a new attribute name and
data type for the result. You then preview the change. If the result is what
you expect, you can add it to the transformation script.
-
Select
Transform.
-
From the transform grid menu, select
Add Attribute.
-
In the
Transformation Editor, specify the Groovy code
necessary add the attribute.
This code can be as simple or as complicated as necessary for
your use case.
In this simple example, the
toUpperCase function examines the
asciiname attribute, converts its values to upper
case, and creates a new attribute called
Name:
-
In
New Attribute Name, specify the name of the
attribute you want to add.
-
From the
Data Type list, choose the data type of the
new attribute.
-
If necessary, uncheck
Single Assign to make the new attribute
multi-assign.
-
Click
Preview to see the results of running the
function displayed in the tabular view, or click
Add to Script to both preview the new
attribute in tabular view and also save the transform to the transform script.
Preview simply highlights the new column for the attribute in
yellow but does not save the change to the transform script.
In this simple example,
Add to Script was selected and you can see the
new attribute
Name to the left of
asciiname.
If you are done making changes to the project data set, you can commit
the changes. See
Running the transformation script against the project data set.