Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

LENGTH

LENGTH

Returns the number of characters in a string, including trailing blanks.

Syntax

LENGTH(
string
)
The following table describes the argument for this command:
Argument
Required/
Optional
Description
string
Required
String datatype. The strings you want to evaluate. You can enter any valid transformation expression.

Return Value

Integer representing the length of the string.
NULL if a value passed to the function is NULL.

Example

The following expression returns the length of each customer name:
LENGTH( CUSTOMER_NAME )
CUSTOMER_NAME
RETURN VALUE
Bernice Davis
13
NULL
NULL
John Baer
9
Greg Brown
10

Tips for LENGTH

Use LENGTH to test for empty string conditions. If you want to find fields in which customer name is empty, use an expression such as:
IIF( LENGTH( CUSTOMER_NAME ) = 0, 'EMPTY STRING' )
To test for a null field, use ISNULL. To test for spaces, use IS_SPACES.

0 COMMENTS

We’d like to hear from you!