Function: TextLine


Splits a multi-line string at the line breaks and returns a specific line by number or by searching for specific search text.

Where string is any string, presumably containing multiple lines, and n is a 1-based index indicating which line is to be returned. Such a string will be the result of trapping a multiple line field using one of the Advanced field properties, End Field On options.

A line break is defined as a LF, i.e., Chr(10), or a CR/LF combination, i.e., Chr(13)+Chr(10). These are the most common forms in which line breaks are found in text values.


TextLine(string,n) or TextLine(string,search)


string is the multi-line string expression to be split. n is the 1-based index specifying which line to return.

Return value

This function returns a character string.

Note: TextLine returns an empty string if n<=0 (is less than or equal to zero) or if n is greater than the number of lines in the given string.

Calculated field example

The following will extract line 2 of a field named Comments that contains a multi-line string. Textline(Comments,2)

Filter/Find example

Records that contain no text in the second line of the Comments field can be found using the following expression. Textline(Comments,2)=""





© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support