Andreas_karl
2nd August 2010, 11:15
Hello,
I have a query which should sum up the whinr110.qstk two times:
1. if whinr110.kost = 1 (tckost.stc.correction)
2. if whinr110.kost = 5 (tckost.issue)
The output should be made in 1 line: Item, Warehouse, Correction, Issue
I cannot get the report handled. Is this possible with the aggregate expression in the report layouts or should it be handled with a script?
bdittmar
2nd August 2010, 11:22
Hello,
I have a query which should sum up the whinr110.qstk two times:
1. if whinr110.kost = 1 (tckost.stc.correction)
2. if whinr110.kost = 5 (tckost.issue)
The output should be made in 1 line: Item, Warehouse, Correction, Issue
I cannot get the report handled. Is this possible with the aggregate expression in the report layouts or should it be handled with a script?
Hello,
define two variables (e.g. qstk.corr and qstk.issue) and sum it based on your condition.
e.g.
if whinr110.kost = 1 (tckost.stc.correction) then
qstk.corr = qstk.corr + whinr110.qstk
endif
if whinr110.kost = 1 (tckost.stc.issue) then
qstk.issue = qstk.issue + whinr110.qstk
endif
Don't forget to set the variables to zero at right position !
Regards
Andreas_karl
2nd August 2010, 12:11
i already tried but it always totaled the whole selection. It should sum up per item and warehouse and it totaled all.
I don't know where to put the variables to zero.
this is my script:
select whinr110.*, tdipu001.*, whwmd215.qhnd
from whinr110, tdipu001,whwmd215
where whinr110.item = tdipu001.item
and whinr110._index1 inrange {:item.f, :cwar.f, :trdt.f} and {:item.t, :cwar.t, :trdt.t}
and tdipu001.otbp between :otbp.from and :otbp.to
and whwmd215._index1 = {whinr110.cwar, whinr110.item}
selectdo
|if whinr110.kost = tckost.issue then
|q.issue = whinr110.qstk
rprt_send()
|endif
|if whinr110.kost = tckost.stc.correction then
|q.corr = whinr110.qstk
rprt_send()
|endif
endselect
bdittmar
2nd August 2010, 13:15
i already tried but it always totaled the whole selection. It should sum up per item and warehouse and it totaled all.
I don't know where to put the variables to zero.
this is my script:
select whinr110.*, tdipu001.*, whwmd215.qhnd
from whinr110, tdipu001,whwmd215
where whinr110.item = tdipu001.item
and whinr110._index1 inrange {:item.f, :cwar.f, :trdt.f} and {:item.t, :cwar.t, :trdt.t}
and tdipu001.otbp between :otbp.from and :otbp.to
and whwmd215._index1 = {whinr110.cwar, whinr110.item}
and (whinr110.kost = tckost.issue or whinr110.kost = tckost.stc.correction)
selectdo
rprt_send()
endselect
Hello,
i would'nd do it in Sessionscript.
send all selected warehouse transactions to report and built the sumary in reportscript.
whinr110.kost must be inputfield.
Regards
Andreas_karl
2nd August 2010, 13:55
Because I want to group the output by warehouse I have a after field whinr110.cwar layout. I think your suggestions only works in a detail layout.
Andreas_karl
2nd August 2010, 14:41
ok problem solved - I used sum(whinr110.qstk) in report script
thanks for your help!