Please enable JavaScript to view this site.

The LEFT function examines a data string and returns the leftmost portion of the data string as specified by a length parameter.

Category

String

Syntax

LEFT(data string, length [,pad character])

 

Parameter Descriptions

data string  -  This parameter specifies a data string in character format. This data string can be a field from a source datastore, a variable or the result of another Function.

length  -  This parameter specifies a numeric value that specifies the number of characters (bytes) to be returned from the source data string.

pad character  -  This is an optional parameter that specifies a character value that will be used for padding to the right of the string.

Example

Examine a source data string INPUT_STRING and map the leftmost 4 characters to the target field OUTPUT_STRING. Assume that the data string INPUT_STRING contains the value MUSTANG.

OUTPUT_STRING  =    LEFT (INPUT_STRING,  4)

Returns the value 'MUST' and maps the result to the target field.

 

Examine a source data string and map the leftmost 2 characters to the target field OUTPUT_STRING.

OUTPUT_STRING = LEFT ('ABCDEFGHIJK', 2)

Returns the value AB and maps the result to the target field.

 

Examine a source data string INPUT_STRING and map the leftmost 8 characters to the target field OUTPUT_STRING. Assume that the data string INPUT_STRING contains the value HELLO.

OUTPUT_STRING = LEFT (INPUT_STRING,  8, '*')

Returns the value 'HELLO***' and maps the result to the target field