ltannous
16th August 2004, 16:37
I have a filed timrp943.dqty that I need to get the totals of this. This field is an array
select sum(timrp943.dqty) does not work.
Any info appreciated
chjagge
16th August 2004, 19:42
Unfortunately I don't believe the array will work like a table where you perform a select using the sum function. You will need to iterate through the all the array elements and have a running total until you get to a empty array location. You can either sum it in the loop or you can send it to a report and use the sum funtion there. Something like
tot.dset = 0
while (array.level() > 0)
long.dset = long.val()
tot.dset = tot.dset + long.dset
endwhile
function domain tcmcs.long long.val()
{
long tmpds
if arr.level < 1 then
message("Array empty")
else
tmpds = dset.arr(1,arr.level)
arr.level = arr.level - 1
endif
return (tmpds)
}