cancel
Showing results for 
Search instead for 
Did you mean: 

Error: String can be at most 65534 characters

Former Member
0 Kudos

Hi,

I am using Crystal XI

I have a string variable in my formula that gathers log ids found when report is run. I then use this variable to display records in my subreports. But when I run a report with wider search criteria I get an error - Error: String can be at most 65534 characters.

How can I get rid of this error? Below is my formula

WhilePrintingRecords;

Global StringVar Array_Name;

numbervar slno;

Array_Name:= Array_Name & Cstr({PMP.LOG_ID}, 0) & ",";

if {@TimelyComplete}= 0 then

slno:= slno+ 1;

What would be an alternative solution for this problem?

Thanks for your help!

-Ekta

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It's kinda a pain, but when I ran into this, I resorted to arrays: Define a global string array and a global number variable that points to the current array element being used. Before concatenating the value to the end of the current element, make sure that the element's length plus the length of the value being concatenated is less than the limit. If not, expand the array by 1 element and assign the new value to the new array element.

HTH,

Carl

Former Member
0 Kudos

Hi Carl,

Thanks a lot for your reply. I am little new to this. I understand what you want me to do. But is it possible for you to please post a sample code that I can follow. That will be a great help.

Thanks a lot!

Former Member
0 Kudos

Storing the values would look something like this (basic syntax):


global vals(1) as string
global nextIndex as number

if nextindex = 0 then
  nextIndex = 1
end if

if len(vals(nextIndex)) + len({field_to_add}) > 65530 then
  nextIndex = nextIndex + 1
  redim preserve vals(nextIndex)
  vals(nextIndex) = {field_to_add}
else
  vals(nextIndex) = vals(nextIndex) + ", " + {field_to_add}
end if

HTH,

Carl

Answers (0)