Solved

Error: an array's dimension must be an integer between 1 and 1000

Posted on 2009-04-07
13
1,672 Views
Last Modified: 2012-11-08
hi, all
i have an error when i run my crystal report:
an array's dimension must be an integer between 1 and 1000
it seems the "Redim Preserve" causing the error.
the code is below:
Shared UnrealisedReducedCostBases() as String
 
Dim key, value, i
 
key = {@SecurityExchange}
value = CStr(Sum({IPSUnrealisedCapitalGainGetByAccount1.ReducedCostBase}, {@SecurityExchange}))
 
i = UBound(UnrealisedReducedCostBases) + 1
Redim Preserve UnrealisedReducedCostBases(i)
 
UnrealisedReducedCostBases(i) = key & "," & value
 
formula = key

Open in new window

0
Comment
Question by:viola123
[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
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
13 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 24094380
Are you saying the error message is incorrect?
Could there be more than 1000 entries?
0
 
LVL 6

Author Comment

by:viola123
ID: 24094427
hi, i mean i have this error, how to solve it.
0
 
LVL 6

Author Comment

by:viola123
ID: 24094440
if there is more than 1000 records returned, the line:
Redim Preserve UnrealisedReducedCostBases(i)
pops up the above error. how to solve it?

thanks
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
ID: 24094470
Crystal Reports does not handle arrays of more than 1000 elements.
So there is no way round that.

You have to look for a different way to create your report.

Can you use running totals, or subreports to limit what you need to hold as an array?
0
 
LVL 6

Author Comment

by:viola123
ID: 24094489
the problem is i am total new to this crystal reports. i dont even understand what is running total,
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
ID: 24094563
You can look at these features in Help but I'm only using them as examples of how you might approach the report.  I have no idea whether they would provide a solution in your case.
You can look at having multiple arrays, combining multiple values into one array 'cell' but again I can't tell you that these will do what you require in your report.
There is no standard solution to this issue.
0
 
LVL 6

Author Comment

by:viola123
ID: 24094635
thanks a lot
i will have a look at if i can use multiple arrays.
0
 
LVL 35

Accepted Solution

by:
James0628 earned 250 total points
ID: 24096165
As has already been said, CR limits arrays to 1000 elements.

 Why are you using an array?  Do you really need to save all of those individual totals?

 It sounds like you have this formula in the detail section.  If so, that's probably a mistake.

 You're saving the total of ReducedCostBase for the {@SecurityExchange} group.  That presumably means that you only need to save the total once for each group.  If the formula is in a detail section, it's going to save the total with every record, saving each group total multiple times.  Put the formula in the {@SecurityExchange} group footer instead.  Then you will only have a problem if you have more than 1000 {@SecurityExchange} groups on one report.

 James
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24100947
I agree.  

Since you are new to Crystal you may not fully understand how Crystal processes the data.  In general arrays are not needed for processing the data.

If you tell us why you need the array or what you are trying to do with it then perhaps we can help.

mlmcc
0
 
LVL 6

Author Comment

by:viola123
ID: 24154869
hi guys,
thanks for all your reply, i pass this problem to another guy who is expect on CR.

so thanks heaps

viola
0
 
LVL 35

Expert Comment

by:James0628
ID: 24164296
You're welcome.

 James
0
 

Expert Comment

by:rochefc
ID: 38576419
Easiest way to trap for null data in an array is to not attempt to print it when your report is generating

For Example
you want to Create an array of addresses

first determine the data that will be in the array

    {Command.PartyName} & Chr(010) &
    iif({Command.PartyAddress1} <> "", {Command.PartyAddress1} & Chr(010), "") &
        iif({Command.PartyAddress2} <> "", {Command.PartyAddress2} & Chr(010), "") & 
        iif({Command.PartyCity} <> "", {Command.PartyCity} , "") &
        iif({Command.PartyState} <> "", {Command.PartyState} & " ", "") & 
        iif({Command.PartyZip} <> "", {Command.PartyZip}, "")


Then Set The Array by adding the AddressArraySet to the Group on your page where the data will display

StringVar Array AddressArry;

    IF NOT ({@Address} IN AddressArry) THEN
        (
            Redim Preserve AddressArry[UBound(AddressArry) +1];
            AddressArry[UBound(AddressArry)]:= {@Address};
        );
    "";

Then finally add the array to where you want it to Display on your form

WhilePrintingRecords;
numberVar n;
StringVar Array AddressArry;
StringVar Array Output;
numberVar cnt;
cnt := UBound(AddressArry);
if(cnt >= 1) then
(
Redim Output[UBound(AddressArry)];
For n := 1 to UBound(AddressArry)
    do(output[n] := AddressArry[n];);
Join(Output, Chr(13))
);

The If(cnt) section is where you are verifying the array has data in it, and if it
does not then it will skip the Display portion and move on eliminating the
error message
0
 
LVL 35

Expert Comment

by:James0628
ID: 38578958
You do realize that that question is over 3.5 years old, right?

 James
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 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