[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# How do I limit the number of characters returned in a variable.

Posted on 2008-06-09
Medium Priority
1,043 Views
I am receiving the following error with this formula in Crystal XI.

A string can be at most 65534 characters long.

How do I limit the number of characters returned?

``````Here is the formula that the report is bombing out on.

whileprintingrecords;
stringvar x:=x+{Database.NOTES}

Type = String and Length is 1000
``````
0
Question by:angeleam
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4
• 3

LVL 101

Expert Comment

ID: 21747550
Do you need to display the full string even if it is over 64K?

You can do this

If Len(x) < 64533 then
x := x + {Database.NOTES}

If you need to display the full string there are ways using arrays of strings.

mlmcc
0

Author Comment

ID: 21752259
I don't need to print if it is over 64. when I use this formula I receive an error: The ) is missing. and it highlights (x)
0

LVL 101

Expert Comment

ID: 21752322

whileprintingrecords;
stringvar x;
If Len(x) < 64533 then
x := x + {Database.NOTES}

mlmcc
0

Author Comment

ID: 21754406
I left out the ;. I think this formula will work for me. Thank you for your reply.
0

Author Comment

ID: 21756464
After validating my data how would display the text if it is over 65534?
0

LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 21762847
If it is over 64K then you need to use an array of strings.

whileprintingrecords;
stringvar array x := [""];
numbervar currentindex := 1;

If Len(x[currentindex]) < 64533 then
x[currentindex] := x[currentindex] + {Database.NOTES}
else
(
currentindex := currentindex + 1;
ReDim Preserve x[currentindex];
x[currentindex] := x[currentindex] + {Database.NOTES};
);

To display you will need several display formulas
First String
whileprintingrecords;
stringvar array x;
x[1]

second string
whileprintingrecords;
stringvar array x;
numbervar currentindex;
If currentindex > 1 then
x[2]

thrid string
whileprintingrecords;
stringvar array x;
numbervar currentindex;
If currentindex > 2 then
x[3]

mlmcc

0

Author Comment

ID: 21763247
Thank You
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
###### Suggested Courses
Course of the Month14 days, 9 hours left to enroll