Solved

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

Posted on 2008-06-09
7
1,036 Views
Last Modified: 2012-08-13
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

Open in new window

0
Comment
Question by:angeleam
  • 4
  • 3
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
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

by:angeleam
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 100

Expert Comment

by:mlmcc
ID: 21752322
Did you add that to your formula as shown below.

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

mlmcc
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

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

Author Comment

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

Accepted Solution

by:
mlmcc earned 500 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

by:angeleam
ID: 21763247
Thank You
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using If, else, then with SQL assistant or Crystal Reports on Joins 6 70
C# Crystal Reports 15 88
Bulk Update Crystal Reports 2013 SP5 Data Source 2 47
Crystal Reports 2013 25 34
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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question