Conditional Sum is not working in Etext Template
Hi Team,
The requirement is to calculate the SUM based on the invoice payment status and have to display under trailer but SUM function is taking all the value and ignoring the condition.
1. first approach : used IF and code is follows:
IF OutboundPayment/PaymentStatus/Code = ‘VOID’ THEN
Sum(OutboundPayment/PaymentAmount/Value)
ELSE
0
END IF
(its not working and its giving total sum of all the invoice in the output)
2. used DECODE
SUM(DECODE(OutboundPayment/PaymentStatus/Code,'VOID’,to_number(OutboundPayment/PaymentAmount/Value),0))
(its taking else part and not giving right value)
Please guide me to solve this.
Thanks in advance.