Almudena Doncel
13th May 2002, 17:46
Sorry I have a mistake in my message

I have problems when I use the agregate function "sum" with arrays, doubles arrays. These codes don“t work:

domain tfgld.amnt amth(3)

select sum(tfgld106.amth):amth
from tfgld106
selectdo
endselect

select sum(tfgld106.amth(1)):amth(1)
from tfgld106
selectdo
endselect

I have to use "SUM" function in SQL Dynamic.

Thanks in advance

mark_h
13th May 2002, 18:26
Here is something to try.


select sum(tfgld106.amth):1
from tfgld106
selectbind(1,amth(1))
selectdo
endselect


Good Luck!

Mark

Almudena Doncel
13th May 2002, 18:47
I have tried to compile the code that you have sent me and the next error message has produced:
Error SQl: Can not apply agregate function to array columm 'tfgld103.amth'.

Could you send me another idea?

Thank you

Caner.B
13th May 2002, 19:39
I faced this problem before and could only sum the records in this way .

selectdo
sum_amth_1=sum_amth_1+ tfgld106.amth(1)
endselect

Caner

mark_h
13th May 2002, 22:36
It appears that the tfgld106 tables are different between our systems. My version of tfgld106 does not have amth as an array. The code I sent works on my system, but the code Caner sent should work.

Sorry about that, but what version of Baan are you all running? Just curious. We are running 4c3.

Mark

Caner.B
14th May 2002, 08:18
We are on Baan IVc3 MCR0
it's a multy currency version. TRL , ECU , USD

Caner

Almudena Doncel
14th May 2002, 10:25
We are working with Baan V, version Corelli. Database definition has changed between Baan IV and Baan ERP.

Thanks all for your help.