calculating a field in the report from another fields in the same records

hello,

I am trying to make a report, I have a field that need to be calculated from another fields in the same records, I made the following function but its not working

Display Real TotalEx()

{

LedgerJournalTrans LGT;

;

while select ExchRate, AmountCurCredit, AmountCurDebit from LGT

{

return (LGT.ExchRate * LGT.AmountCurCredit) + (LGT.ExchRate * LGT.AmountCurDebit);

}

//return (LedgerJournalTable_ExchRate * LedgerJournalTrans_AmountCurCredit); // + (this.ExchRate * this.AmountCurDebit);

}

its a ledgerjournal report, (with few modifications happened already) I need to add a field that will be calculated from multiplying the debit or credit field by the Exchrate…

any advice…

thanks

Ahmad

When you want the values from same record, why cannot you use the available LedgerJournalTrans buffer(present in the query)? why you are using the while loop?

actually I am new to axapta, anyway I used it and it worked without the while:

Display Real TotalEx()

{

;

return (LedgerJournalTrans.ExchRate * LedgerJournalTrans.AmountCurCredit) + (LedgerJournalTrans.ExchRate * LedgerJournalTrans.AmountCurDebit);

}

Cheers man…

Ahmad