Solved

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

Posted on 2009-04-07
13
1,591 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
  • 5
  • 3
  • 3
  • +2
13 Comments
 
LVL 77

Expert Comment

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

Author Comment

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

Author Comment

by:viola123
Comment Utility
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
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 6

Author Comment

by:viola123
Comment Utility
thanks a lot
i will have a look at if i can use multiple arrays.
0
 
LVL 34

Accepted Solution

by:
James0628 earned 250 total points
Comment Utility
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 100

Expert Comment

by:mlmcc
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
You're welcome.

 James
0
 

Expert Comment

by:rochefc
Comment Utility
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 34

Expert Comment

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

 James
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now