I’m writing a report which needs to ignore Customer Ledger Entries thyat have a Document Type of either Invoice or Cedit Memo. No matter what code I put in it still prints these Doc Type. Can I code a SETRANGE to ignore these types, if so how and which section of the report should it be in, OnPreDataItem or OnAfterGetrecord. Or what should I be coding.
Cust. Ledger Entry - OnPreDataItem() SETFILTER("Document Type", '<>%1&<>%2', "Document Type"::Invoice, "Document Type"::"Credit Memo");
You can skip the records by sticking this code in the OnAfterGetRecord trigger:
IF "Document Type" IN [ "Document Type"::Invoice, "Document Type"::"Credit Memo"] THEN CurrReport.SKIP; If you prefer to filter them out instead of skipping them (test it, one option can be faster than the other depending on the filters set, etc.), you can use the DataItemTableView property of the Customer Ledger Entry DataItem. Set it to something like WHERE(Document Type=FILTER(<>Invoice&<>Credit Memo)).  I got distracted with the phone and Steffen was faster. His method also works.
Thanks you both, all working now. Paul