Can't get the Amount of other options from Document Type field in CLE table in my report.

Hello Experts,

I have created a report based on ‘Cust. Ledger Entry’ table. In ‘Document Type’ field of ‘Cust. Ledger Entry’ table there are many options like: Invoice, Payment, Credit Memo. The CLE table also contains an ‘Amount’ field which shows the amounts for different Document Types.

Now in my report I need to create three different fields in which I can display the sum of the amounts of their related Document Types i.e.

Invoice Amount Payment Amount Credit Memo Amount

Shows the sum of all the Shows the sum of all the Shows the sum of all the

Amounts for all the Invoices Amounts for all the Amounts for all the Payments Credit Memos

for that I have written the following code:

Cust. Ledger Entry - OnAfterGetRecord()

‘‘Cust. Ledger Entry’’.SETRANGE(’‘Cust. Ledger Entry’’.“Document Type”,Cust. Ledger Entry’’.“Document Type” :: Invoice);

By using this code I can only able to get the records of all the Invoice amounts. But how can I get the Amounts of all the other options like Payment, Credit Memo. Please help me.


I would like to see your report, can you export it into txt and share?

I have done one example that might help you, please look and let me know your feedback.

Cust. Ledger Entry - OnPreDataItem()
{ Document Types
,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund
Payment = 1
Invoice = 2
Credit Memo = 3
Finance Charge Memo = 4
Reminder = 5
Refund = 6 }

FOR i := 1 TO 6 DO BEGIN
“Cust. Ledger Entry”.RESET;
SETRANGE(“Customer No.”,‘10000’);
SETRANGE(“Document Type”,i);
IF COUNT = 0 THEN CurrReport.SKIP;

Cust. Ledger Entry - OnAfterGetRecord()

  1. Either you can define three different variables and filter on required option which will give you three different values
  2. Use Case Statement
  3. User If Statement

Do you Got The Solution ??