This simple data type denotes a text string.


Microsoft Dynamics NAV 2013 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.


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

  Copy Code
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