metalgears
Technical User
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)
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)