[b]Cust. Ledger Entry - OnAfterGetRecord()[/b] "Cust. Ledger Entry".SETRANGE("Posting Date",0D,GETRANGEMIN("Date Filter")); "Cust. Ledger Entry".SETRANGE("Cust. Ledger Entry"."Document Type","Cust. Ledger Entry"."Document Type"::Invoice); IF "Cust. Ledger Entry".FINDFIRST THEN TotalSettlement += "Cust. Ledger Entry".Amount; "Cust. Ledger Entry".RESET; "Cust. Ledger Entry".SETRANGE("Posting Date",GETRANGEMIN("Date Filter"),GETRANGEMAX("Date Filter")); "Cust. Ledger Entry".SETRANGE("Cust. Ledger Entry"."Document Type","Cust. Ledger Entry"."Document Type"::Invoice); IF "Cust. Ledger Entry".FINDFIRST THEN TotalPayment += "Cust. Ledger Entry".Amount;But when running report, the Date Filter error
Comments
start your code with:
"Cust. Ledger Entry".setfilter("Date Filter",010120D,311220D);
end your code with:
error('Result: %1 %2', TotalSettlement,TotalPayment)
And see what happens.
RIS Plus, LLC
- GETRANGEMIN and GETRANGEMAX gets the minimum and maximum values of a filter range. In your sample, you don't have a value in your date filter, so that's why the system is giving you an error
- To get the minimum date and the maximum date from a set of records, you need to first sort the records by the date, then do a FINDFIRST to read the first record, and then do a FINDLAST to read the last record. You can then use the date field value to set the filters. I don't understand why you would set that filter though, because with those values you will get all records anyway, so that filter is not effective
I didn't run this report, but this shows where to put the code and how to use some of the AL commands that you are trying to use You should really have a senior that can answer these types of questions. If you don't have a senior, then I would suggest that you get the programming book by David Studebaker.RIS Plus, LLC