Text Data Type

This simple data type denotes a text string.

Remarks

Microsoft Dynamics NAV 2016 does not enforce a limit on the length of a Text variable. You can specify a maximum length in the C/AL Globals or C/AL Locals window when you create the variable, but it is not required. There is no performance impact if you do not specify a length. The maximum length of a Text field in a table is 250 characters. The length of a text variable equals the number of characters in the string. An empty text string has a length of zero (0). A text string cannot be null.

You can index any character position in a text string, for example A[65]. The resulting value will be a Char Data Type.

You cannot assign a char to a position in the code variable greater than the current length of the variable +1. For more information, see Char Data Type.

The Text data type supports Unicode.

Example

This example shows some typical examples of text strings. In these examples, the text variable has a maximum length of 6.

text := 'ABC';
// Results in a text variable which contains 'ABC'.
text := '123456abc';
// Results in a run-time error because the length (9)
// exceeds the maximum length of 6.

See Also

Reference

CONVERTSTR Function (Code, Text)
COPYSTR Function (Code, Text)
DELCHR Function (Code, Text)
DELSTR Function (Code, Text)
FORMAT Function (Code, Text)
INCSTR Function (Code, Text)
INSSTR Function (Code, Text)
LOWERCASE Function (Code, Text)
MAXSTRLEN Function (Code, Text)
PADSTR Function (Code, Text)
SELECTSTR Function (Code, Text)
STRCHECKSUM Function (Code, Text)
STRLEN Function (Code, Text)
STRPOS Function (Code, Text)
STRSUBSTNO Function (Code, Text)
UPPERCASE Function (Code, Text)