How to Sum By Customer Posting Group.

I am trying to sum customers total balances by Posting Group. Here is a code i wrote but it not working. can someone help me with this.

IF Customer.“Customer Posting Group” = ‘BAK’ THEN BEGIN
IF Customer.“Monthly Install” <> 0 THEN BEGIN
//BAKTotalCustBal := “Detailed Cust. Ledg. Entry”.“Amount (LCY)”;
BAKCustBal1 := “Cust. Ledger Entry”. Amount;
BAKArreasVar:= -Customer.“Monthly Install” - “Cust. Ledger Entry”.Amount;
BAKTotCustBal1 += BAKCustBal1;

I need it like this
BAK -------------- 20000 i.e the total arrears for all the customers with Posting group of BAK
BTU…32090 ans so on

I to create a report the display the information as above.
Can somone help me Please.

Can someone help me with this problem please.

The balance can be obtain by the flowfield, but the arears is obtained by -Customer.“Monthly Install” - “Cust. Ledger Entry”.Amount; where the is a Monthly Install for each customer and the amount is deducted from it.

I need only the grand total of both the balance and the arrears in the format mentioned in my earlier post.


Not all fields are stored in detailed customer ledger entries. For example you have report Customer - Trial Balance. That reports groups balance by customer posting group defined in customer card.

If you want sum by customer posting not in customer card but at ledger entries you will have to sum entry by entry because customer posting group isn’t stored at detailed customer ledger entries.

I am using the Customer table and cust. ledger entry tables as dataitems. I also need to show grand totals of the arrears. there is a minimum amount of money called monthly install that is paid by the each customer every month. This is repayment. the report is for mortgage customers whoo pay monthly install every month. So the report is to track balances and arrears for each customer.

How can i do this?