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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RE: Array in Subreport

Status
Not open for further replies.

metalgears

Technical User
Apr 8, 2005
13
CA
This array formula works fine on main report. The counter "i" increments and the array gets populated. The customer orders are aggregated together by customer name.

When I put the same array formula in the subreport, the counter "i" stays at 1 and does not increase. The array does not pick up the duplicated customer name and add their totals. It just puts each customer and their total in the array as a separate array element

It seems that everytime the subreport detail is executed, all the variables are resetted.

Any help would be appreciated.
TIA.

shared c() as string
shared o() as currency

shared i as number
dim j as number
dim b as boolean

if onfirstrecord or {Customer.Customer Name}<> previousvalue({Customer.Customer Name})then
redim c(1)
redim o(1)
c(1) = {Customer.Customer Name}
o(1) = {Orders.Order Amount}
i = 1
else
for j = 1 to ubound(c)
if ({Customer.Customer Name} in c(j)) then
o(j) = o(j) + {Orders.Order Amount}
b = true
exit for
end if
next j
if b = false then
i = i+1
redim preserve c(i)
redim preserve o(i)
c(i) = {Customer.Customer Name}
o(i) = {Orders.Order Amount}
end if
end if

formula = o(i)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top