Adding an attribute

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.

To add an attribute:

  1. Select Transform.
  2. From the transform grid menu, select Add Attribute.
    For example:
    This image show the menu options of the transform data grid menu.

  3. 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:
    Shows the Transformation Editor with a very simple function example

  4. In New Attribute Name, specify the name of the attribute you want to add.
  5. From the Data Type list, choose the data type of the new attribute.
  6. If necessary, uncheck Single Assign to make the new attribute multi-assign.
  7. 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.
    Shows the results of adding a new attribute in the table view.

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.