Crystal Reports Error: A string can be at most 65534 characters long


When you followed the directions in the manuals of the following products to create reports, you encounter the following error message: A string can be at most 65534 characters long.

  • PDF417 Fontware, 4.0 and 4.1.0

  • QRCode Fontware 1.0


The documentation contains a typo. The syntax to assign value to a variable is colon plus equal (:=), not equal(=).


Open the formula in formula editor and navigate to this line:

StringVar BarcodeString = "";

Change it to:

StringVar BarcodeString := "";


Because Crystal UFL limits the string returned to 254 characters, barcode string must be divided into chunks and concatenated together. In order to get the full barcode string, you first call a Set function to pass data encoded and encoding parameters, and get the number of chunks as return value. Subsequent Get functions are called to retrieve contents of each chunk. Concatenate all the chunks together you get the full barcode string.

Under Crystal syntax, all variables have global scope by default. The global scope means that the variable shares its value across all formulas, including the instances of the same formula. Therefore all variables must be initialized properly.

The equal assignment is not documented in Crystal Reports; however, the program does not report an error. With equal operator, the variable is initialized only once. Because it does not remove the content of the last run, the content of BarcodeString variable will accumulate, until the length runs out of the max limit (65534 characters).