while select sum does not work it

Hello Guys,

I have code blog down blog: I am trying to show sum amount off payback.amountcurInterest   and Amountcur of payback table.

For Amountcur I should group by payback.CrdtShortLong(long or short)


if CrdtLinePayback).CrdtShortLong=short then it should sum  up the related lines'  

I should Write something like this on this code blog

LedgerTransJournal.AmountCurCredit +=paybackk.AmontcurInterest;it should sum up the Interest of payback's table

if(payback.CrdtShortLong =CrdtShortLong:short) then

LedgerTransJournal.AmountCutcredit  +=payback.amountcur it should sum up the amountcur of paybackk

aLso there is a case that ,in sametime  I can have journal lines like short term and log term , I should show separetly their amount too


this is the code blog:

while select sum(AmountCur) from payback where payback.CrdtId == crdttable.CrdtId
ledgerJournalTrans.Voucher = voucher;

ledgerJournalTrans = setLedgerJournalTransCommonField( voucher,
AmountCurDebit += Currency::amount(payback.BSMVInterest());
if(payback.BuzCrdtShortLong == CrdtShortLong::ShortTerm)

I wrote in here  the both code but it did not work it.

AmountLongInterest += payback.BSMVInterest();
AmountLong += Currency::amount(payback.AmountCur + payback.BSMVInterest());

AmountShortInterest += payback.BSMVInterest();
AmountShort += Currency::amount(payback.AmountCur + payback.BSMVInterest());


ledgerJournalTrans.AmountCurDebit = Currency::amount(payback.BSMVInterest());
ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger;
ledgerJournalTrans.CurrencyCode = CrdtTable.currencyCode;
ledgerJournalTrans.ExchRate = CrdtTable.ExchRate;