Transformation by Example (TBE) enables you to build recipe objects by mapping example output values for source values.  then interprets the differences between the inputs and outputs to determine the transformation required to map them. 

TBE leverages pattern-based matching and predictive transformation to derive transformations. When you provide explicit mappings of input value to output, the mapping is passed through predictive interaction to determine the best possible matching pattern.

Use cases:

Tip: TBE simplifies the process of defining patterns to match all values in your source column. Since you know and can specify the exact desired output, you can leave the details of defining the pattern or patterns required to match input to output to the product.

Transformation by Example works well in the following use cases:

Limitations

Column by Example

In column-by-example transformations, you create a new column from an existing one by mapping input to output values.

General workflow:

  1. Select the column to use as input data. 
  2. Change the column to String data type, if needed. 
  3. From the column menu, select Create column from examples. See Transformation by Example Page.
  4. Transform by example:
    1. Locate a row containing an example value to transform.
    2. In the corresponding row in the Preview column, you can enter in the new value to which the input is mapped.
    3. The transformation in development is updated to accurately capture the mapping you just performed. Additional rows in the output column may be accurately mapped, as well.
  5. Repeat the above steps until all values in the output column appear to be accurately mapped. 
  6. When satisfied, add the transformation to your recipe. 
  7. Change the data type of the target and the source columns, if needed.
  8. Remove the source column, if needed.

For more information, see Create Column by Example.

CBE for Datetime

Column-by-example also works on Datetime columns. When you use a Datetime column as your input, you specify the output values in the date/time format that you wish to use. That input value and all similarly formatted inputs should be converted to the output format. You can then specify additional example outputs for input values in a different format to standardize all of the values in the output column.

NOTE: For Datetime formatting to work properly, the input column must be specified as Datetime data type.

Alternatives

For string-based inputs, the following options in  may assist in performing the same functions that you are trying to do in TBE:

Description
Extract TransformYou can use the extract transform to retrieve sub-strings from a column and insert into a new column.
String Functions

supports a variety of string manipulation functions, which can be used to gather data from a string.