Code Data Type
This simple data type denotes a special type of string that is converted to uppercase and removes any trailing or leading characters.
The length of a Code variable equals the number of characters in the text without leading or trailing spaces.
The maximum length of a Code field in a table is 250 characters. The maximum length of a Code variable is 1024 characters.
A Code variable cannot be null.
You can index any character position in a string, such as A. The resulting value will be a.
Fields that contain a date formula must not have data type Code. Instead, use the. All fields that contain a date formula with data type Code must be converted into data type DateFormula.
Differences Between the Classic Client and RoleTailored Client
In the RoleTailored client, 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.
This example shows some typical examples of code string assignments. In these examples, assume that the variable c is a code variable with a maximum length of 4.
c := 'ABC'; // Results in variable c, which contains 'ABC' // and is 3 characters in length. c := '1'; // Results in variable c, which contains '1' // and is 1 character in length. c := ''; // Results in variable c, which contains '' (empty string) // and is zero (0) characters in length. c := ' 2 '; // Results in variable c, which contains '2' // and is 1 character in length.