The MID function allows you to extract a substring from a source data string based on a user specified starting position and length.
Category
String
Syntax
MID(data_string, start_position, length)
Parameters and Descriptions
Parameter | Description |
---|---|
data_string | The data string in character format. This data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
start_position | This parameter specifies the starting position of the substring that is to be extracted from the data string. |
length | This parameter specifies the length of the substring that is to be extracted from the data string. |
Example
Extract a substring from a source field INPUT_STRING that begins in position 11 and has a length of 4 characters and map the result to target field TGT_STRING. Assume that INPUT_STRING contains the value This is a test scenario.
TGT_STRING = MID (INPUT_STRING, 11, 4)
Returns the value 'test' and maps the result to the target field.