cancel
Showing results for 
Search instead for 
Did you mean: 

subscript error message

Former Member
0 Kudos

Post Author: elkie

CA Forum: General

hey all, working on a crystal xi report and i'm getting this error message. I've search around and couldn't find anything that will help.

error is : A subscript must be between 1 and the size of the array.

formal is

WhilePrintingRecords;

Global NumberVar Array MonDeptHours;

MonDeptHours[5]

Error is on the MonDeptHours[5]

Any suggestions? Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: btenpenny

CA Forum: General

I wish someone more here would answer this question, as I'm running in to the exact same problem with arrays. Using the example from the document "Advanced reporting techniques for creating Arrays in Crystal Reports" from BO's technical papers section:

whileprintingrecords;Numbervar Array MyArray;If {CHANGE_REQUEST.CR_PRIORITY} = "Low" // Modified to reflect my data sourceThen MyArray [2] := 50Else MyArray [4] := 83

CR generate the same Subscriopt error as referenced in the earlier post. THIS IS THE EXAMPLE FROM THE BO TECH DOCS AND IT DOES NOT WORK!. I have also tried a handful of the examples from the help file included with CRXI. The only ones that work are ones where the elements of the array are defined on in the variable definition (Like this: Global NumberVar Array x := [10 , 20, 30];). Variable are pretty much useless if I have to define them at declaration. What is going on here?

Former Member
0 Kudos

Post Author: KenTurner

CA Forum: General

The fact that your array variable is declared as Global means that it is probably being used in two or more different formulas, and so the number of elements in the array, and the values they contain, are being established elsewhere.You need to find all formulas which declare and use this same variable, and my guess is you will discover that the number of elements is less than 5.