Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error - Subscript must be between 1 and the size of the array 1

Status
Not open for further replies.

jeffm777

IS-IT--Management
Nov 10, 2009
108
US
I'm developing a report to chart warranty sales as a % of total sales by quarter for year to date + the last 3 full years. The problem is the warranty sales year to date total is 0.00 while the year to date sales total is 76,000. When I pass the shared variable thru from the top level report to the subreport, my groupnumber returns 13 but since 0.00 / 76,000 = 0, it only shows 12 values. Here is the formula that is giving the error...

whileprintingrecords;
shared stringvar chartVal;
local stringvar temp1 := Left(chartVal, len(chartVal)-1);
tonumber(split(temp1,"^")[groupnumber]);
 
I don't see why you wouldn't have a zero returned for the 13th value. Can you show us the values for chartVal in the main report per groupnumber? Also, please show the contents of the formula where you set up the chartVal variable.

-LB
 
My groupnumber13 on the main report is returning nothing (see below):

groupnumber1 = 0.35^
groupnumber2 = 0.35^0.18^
groupnumber3 = 0.35^0.18^0.53^
groupnumber4 = 0.35^0.18^0.53^0.37^
groupnumber5 = 0.35^0.18^0.53^0.37^0.21^
groupnumber6 = 0.35^0.18^0.53^0.37^0.21^0.25^
groupnumber7 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^
groupnumber8 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^0.06^
groupnumber9 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^0.06^0.11^
groupnumber10 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^0.06^0.11^0.05^
groupnumber11 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^0.06^0.11^0.05^0.11^
groupnumber12 = 0.35^0.18^0.53^0.37^0.21^0.25^0.29^0.06^0.11^0.05^0.11^0.21^
groupnumber13 =

The formula I'm using for the main report chartVal is:

shared stringvar chartVal := chartVal & Sum ({@warrantySales}, {SalesClass.RecDate}, "quarterly") / Sum ({SalesClass.SalePrc}, {SalesClass.RecDate}, "quarterly") *100 & "^"

The warranty figures reside in two fields so the @warrantySales formula is:

{SalesClass.WarrantyAmtLabor} + {SalesClass.WarrantyAmtParts}
 
You need to change your warranty sales formula to:

if isnull({SalesClass.WarrantyAmtLabor}) or
isnull({SalesClass.WarrantyAmtParts}) then
0 else
({SalesClass.WarrantyAmtLabor} + {SalesClass.WarrantyAmtParts})

-LB
 
Once again, you're right on the money! Many thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top