?
Solved

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

Posted on 2009-04-07
13
Medium Priority
?
1,708 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
Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 500 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 500 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 500 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

765 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