You are here: Processor Library > Transformation > Trim Characters
The Trim Characters processor trims text attribute values down to a set number of characters - taken from the left, the middle, or the right of the original value, according to the specified Options.
The result of the trim is output as an additional attribute.
Use
Use Trim Characters to truncate a text value down to a set number of characters. For example, you may be manipulating your data prior to matching, and may wish to create a new matching cluster which comprises the first few characters of one attribute, and the last few characters of another. In this case, you would use Trim Characters twice - once to take the first few characters of one attribute, and again to take the last few characters of another.
If you want to perform exactly the same trim operation on more than one attribute, you may do this in a single use of the Trim Characters processor.
Configuration
Inputs
Any String or String Array type attributes that you wish to trim to a set number of characters. Number and Date attributes are not valid inputs, as they do not have a single standard text representation. If you wish to trim a Date or Number attribute, you must first convert the data type to String with a standard representation (for example, DD/MM/YYYY for a date) using Convert Number to String or Convert Date to String.
Note that if you input an Array attribute, the transformation will apply to all array elements, and an Array attribute will be output.
Options
Option | Type | Purpose | Default Value |
Length of result | Number | The number of characters that you wish to retain after trimming | 1 |
Start position | Number | The start position for the trim operation, counted either from the left or the right of the value, in characters. 1 would mean the first character, if counting from the left, or the last character if counting from the right. Note that whitespace and control characters are included in this count, and should therefore be removed if you do not want to consider them. | 1 |
From left or right | Selection (Left/Right) | Determines how the start position for the trim is determined; that is, counting a number of characters to retain from either the left or the right of the value. | Left |
Outputs
Data attributes
Data attribute | Type | Purpose | Value |
[Attribute Name].Substring | Derived | The trimmed version of the attribute value | The original attribute value, trimmed using the options specified. |
Flags
None
Execution
Execution Mode | Supported |
Batch | Yes |
Real time Monitoring | Yes |
Real time Response | Yes |
Results Browsing
The Trim Characters transformer presents no summary statistics on its processing.
In the Data view, each input attribute is shown with its new derived trimmed attribute to the right.
Output Filters
None
Example
In this example, the Trim Characters processor is used to return the day portion (the first two characters) of the DT_PURCHASED attribute of the Customers table in the example Service Management data.
Note that the DT_PURCHASED attribute is in this case already stored as a String attribute. A DATE attribute may be converted to String using the Convert Date to String processor, if required.
The following shows the results of the transformation:
Oracle ® Enterprise Data Quality Help version 9.0
Copyright © 2006,2011 Oracle and/or its affiliates. All rights reserved.