Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle string greater than 65534 characters

Status
Not open for further replies.

ekta22

IS-IT--Management
May 3, 2004
359
US
Hi,

I am using Crystal XI. I have the formula below in the detail section. This formula gathers all the LOG IDs and then pass them to my subreport. But when large data is returned I get the "A string can be at most 65534 characters long" error.

Formula in Detail section - @frlDisplay:

Code:
WhilePrintingRecords;
Global StringVar Array_Name;
numbervar slno;

Array_Name:= Array_Name & Cstr({PMP.LOG_ID}) & ",";
slno:= slno+ 1;

I then have the below two formula's in my GF2 where I have my subreport.
@frlPopulate
Code:
WhilePrintingRecords;
Global NumberVar N;
Global stringVar Arr_Display;
Global stringVar Array_Name;

If Array_Name <> "" then Arr_Display:= Left(Array_Name, len(Array_Name)-1)

@frlShow
Code:
WhilePrintingRecords;
numbervar slno;

Currently, the formula in detail section is concatenating each and every log id it finds, which makes the string too big. But in the subreport, I want to display fewer records based on two formula's. Is there a way I can limit the @frlDisplay formula from concatenating all the Log ID's and use those two formula's to limit it somehow?

One of the formula would be something like - Concatenate only those log id's where
PMP.STATUS = "C" AND PMP.CODE = "L"

Hope it's not too confusing. Thanks a lot for your help in advance!
 
If you are displaying these at the group level, then you should have a reset formula for the corresponding group header (GH2):

whileprintingrecords;
StringVar Array_Name;
numbervar slno;
if not inrepeatedgroupheader then (
Array_Name := "";
slno := 0
);

How are you passing these to the sub? By linking on the formula? You don't have these set up as shared variables currently.

To limit the values concatenated, you can use:

WhilePrintingRecords;
StringVar Array_Name;
numbervar slno;
if PMP.STATUS = "C" AND
PMP.CODE = "L" then (
Array_Name := Array_Name & Cstr({PMP.LOG_ID}) & ",";
slno := slno+ 1
);

If log IDs can appear more than once, then change the formula to:

WhilePrintingRecords;
StringVar Array_Name;
numbervar slno;
if PMP.STATUS = "C" AND
PMP.CODE = "L" and
not(Cstr({PMP.LOG_ID}) in Array_Name) then (
Array_Name := Array_Name & Cstr({PMP.LOG_ID}) & ",";
slno := slno+ 1
);

-LB
 
I do have a reset formula in my GH2 which looks like below

WhilePrintingRecords;
numbervar slno:=0;

Yes I am linking on frlPopulate formula and also the parameters from the main report.

Log IDs cannot appear more than once.

I am going to try your suggestion and get back to you. I actually need to filter on 4 formulas and not 2. Can I use the formula name instead of typing the actual formula logic? So instead of using, if PMP.STATUS = "C" AND
PMP.CODE = "L", can I use the formula name somehow?

Thanks!
 
I think you should be resetting the string, too. I don't know what your formula is or what the advantage is in using it in the other formula. I don't like using nested formulas ordinarily as it is too easy to lose track of what you are doing.

-LB
 
Just wanted to update you that I got it to work. Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top