cancel
Showing results for 
Search instead for 
Did you mean: 

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

GSG
Participant
0 Kudos
284

Hello All,

I am getting the following error :

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

with the following formula. Please advise.

WhilePrintingRecords;

stringvar array plant;

redim preserve plant[GroupNumber];

plant[GroupNumber] := GroupName ({Command.EVSTRNAME});

View Entire Topic
DellSC
Active Contributor
0 Kudos

You have to initialize an array with at least one entry before you can call ReDim on it. Also, I wouldn't necessarily use "GroupNumber" - instead I would use Ubound() to determine the current size of the array.

So, here's what you'll change your formula to something like this:

WhilePrintingRecords;
StringVar array plant := MakeArray(1);
NumberVar i;
If OnFirstRecord then 
  plant[1] := GroupName({Command.EVSTRNAME});
else (
    i := UBound(plant);    
    redim preserve plant[i + 1];
    plant[i + 1] := GroupName({Command.EVSTRNAME});
);
""

The final empty string at the end of the formula allows you to put the formula on your report so that it will calculate but won't show anything.

Also, if you're using just the data value for a group's name and aren't using a formula for the group name, you don't need to use the "GroupName()" function - you can just use the field.

Finally, I see you're using a command. If you haven't already, I suggest you read this blog about best practices for working with commands.

-Dell

GSG
Participant
0 Kudos

Hello Dell,

Thank you for the reply. It seems like at "Else" formula is not being recognized. Please see below:

"The remaining text does not appear to be part of the formula.

I tried to add a screenshot but the comment section does not allow it. Thx

GSG
Participant
0 Kudos

I was able to make it work. Thank you Dell for your help. Here is my updated formula:

WhilePrintingRecords;

StringVar array plant := MakeArray( " ");

NumberVar i;

If OnFirstRecord then plant[1] := GroupName({Command.EVSTRNAME})

else ( i := UBound(plant);

redim preserve plant[i + 1];

plant[i + 1] := GroupName({Command.EVSTRNAME});

); ""

GSG
Participant
0 Kudos

Hello Dell,

I have got the same error when published on the server. Here is the error details;

2021-10-01 13:26:20
com.businessobjects.report.web.shared.WebReportingException: The viewer could not process an event. Error in File CONT Working Hours - Oct1:
Error in formula  Formula1: 
'WhilePrintingRecords;
'
An array's dimension must be an integer between 1 and 1000.

Error in formula  Formula1: 
'WhilePrintingRecords;
'
An array's dimension must be an integer between 1 and 1000.
Details: errorKind---- Error code:-2147215357 [] Error code name:internal

Show Details Hide Details
DellSC
Active Contributor
0 Kudos

Is there a chance that {Command.EVSTRNAME} is null? If so, set the null handling to "Default values for null" and see whether that will help.

-Dell

GSG
Participant
0 Kudos

Thank you Dell for your reply. Really appreciated your prompt reply.

Gurpreet