I receive the following message upon report execution with a report developed with CRv7:
"A subscript must be between 1 and the size of the array"
The formula editor accepts the syntax of the formulas involved. Both formulas have the array explicitly defined as Global where it is created and loaded. The array is also referenced as a Global array in the formula that actually generates the error message. Here are the formulas:
@CurrentTot
@CurrThroughLastMonth
The array contains database field values corresponding to sales information for each month. Each month is a separate field value and array element.
In trying to troubleshoot this problem, I've tried to output the individual values of the array, but they appear to be null, despite the fact that I do a null test before the array is loaded and initialize the array with zeros.
Is it my logic, syntax, or am I trying to do something that CRv7 cannot do?
"A subscript must be between 1 and the size of the array"
The formula editor accepts the syntax of the formulas involved. Both formulas have the array explicitly defined as Global where it is created and loaded. The array is also referenced as a Global array in the formula that actually generates the error message. Here are the formulas:
@CurrentTot
Code:
NumberVar CurrJanS:=0;
NumberVar CurrFebS:=0;
NumberVar CurrMarchS:=0;
NumberVar CurrAprilS:=0;
NumberVar CurrMayS:=0;
NumberVar CurrJuneS:=0;
NumberVar CurrJulyS:=0;
NumberVar CurrAugS:=0;
NumberVar CurrSeptS:=0;
NumberVar CurrOctS:=0;
NumberVar CurrNovS:=0;
NumberVar CurrDecS:=0;
NumberVar CurrMthS:=0;
Global NumberVar array ActualMonthlySales:= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
//January:
If IsNull({CONTACT2.UFCJAN}) then CurrJanS:=0 else
if NumericText({CONTACT2.UFCJAN}) = True then CurrJanS:=(ToNumber({CONTACT2.UFCJAN}))
else CurrJanS:=0;
//convert remaining months per Jan...
Global NumberVar array ActualMonthlySales:= [CurrJanS, CurrFebS, CurrMarchS, CurrAprilS, CurrMayS, CurrJuneS, CurrJulyS, CurrAugS, CurrSeptS, CurrOctS, CurrNovS, CurrDecS];
CurrMthS:= Sum(ActualMonthlySales [1 to 12]);
//(CurrJanS+CurrFebS+CurrMarchS+CurrAprilS+CurrMayS+CurrJuneS+CurrJulyS+CurrAugS+CurrSeptS+CurrOctS+CurrNovS+CurrDecS);
CurrMthS;
Code:
NumberVar CurrentThruLastMonth:= 0;
Global NumberVar array ActualMonthlySales;
If {@Month} = 1 then CurrentThruLastMonth:=0 else
CurrentThruLastMonth:= ActualMonthlySales[2];
//CurrentThruLastMonth:= Sum (ActualMonthlySales [1 to ({@Month} - 1)]);
In trying to troubleshoot this problem, I've tried to output the individual values of the array, but they appear to be null, despite the fact that I do a null test before the array is loaded and initialize the array with zeros.
Is it my logic, syntax, or am I trying to do something that CRv7 cannot do?