viola123
asked on
Error: an array's dimension must be an integer between 1 and 1000
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:
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
ASKER
hi, i mean i have this error, how to solve it.
ASKER
if there is more than 1000 records returned, the line:
Redim Preserve UnrealisedReducedCostBases (i)
pops up the above error. how to solve it?
thanks
Redim Preserve UnrealisedReducedCostBases
pops up the above error. how to solve it?
thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the problem is i am total new to this crystal reports. i dont even understand what is running total,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot
i will have a look at if i can use multiple arrays.
i will have a look at if i can use multiple arrays.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
hi guys,
thanks for all your reply, i pass this problem to another guy who is expect on CR.
so thanks heaps
viola
thanks for all your reply, i pass this problem to another guy who is expect on CR.
so thanks heaps
viola
You're welcome.
James
James
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(Address Arry) +1];
AddressArry[UBound(Address Arry)]:= {@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
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
iif({Command.PartyAddress2
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(Address
AddressArry[UBound(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
You do realize that that question is over 3.5 years old, right?
James
James
That answer from 2012 actually helped me in 2018! Thanks!
Could there be more than 1000 entries?