Skip to main content
Microsoft Dynamics NAV forum
Suggested answer

How to set report filter

editSubscribe (0) ShareShare
Posted on by UG Leader

Hi Experts,

I want to set the report filters, below code i have used in cust ledger entry predataitem but i cant get the correct value please help me on this one.

CustLedgerpostings - OnPreDataItem()
SETRANGE("Posting Date",Date2,Date1);
SETRANGE("Date Filter",Date2,Date1);
SETRANGE("Entry No.",DetailedCustomerLedgerEntry."Cust. Ledger Entry No.");

CustLedgerpostings - OnAfterGetRecord()
PostingAmount2 := 0;
DetailedCustomerLedgerEntry.SETRANGE("Cust. Ledger Entry No.",PostedEntries."Entry No.");
DetailedCustomerLedgerEntry.SETRANGE("Posting Date",Date2,Date1);
IF DetailedCustomerLedgerEntry.FINDSET THEN
//PostedEntries.CALCFIELDS("Remaining Amount");
PostingAmount2 += DetailedCustomerLedgerEntry.Amount;
// MESSAGE('%1',PostingAmount2);
UNTIL DetailedCustomerLedgerEntry.NEXT= 0;
UNTIL PostedEntries.NEXT= 0;


but last filter is not applying SETRANGE("Entry No.",DetailedCustomerLedgerEntry."Cust. Ledger Entry No.");  

please tell me i can i give filter from DetailedCustomerLedgerEntry table to custledger entry predataitem 


Thanks & Regards,


  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,152 on at
    RE: How to set report filter

    You've not posted the report dataset structure here, so it's quite difficult to imagine what you have done.

    Are you sure that in OnPreDataItem you have a value for DetailedCustomerLedgerEntry."Cust. Ledger Entry No."? You can have that only if CustLedgerpostings  is an indented dataitem related to DetailedCustomerLedgerEntry.

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,080 Super User

Martin Dráb Profile Picture

Martin Dráb 222,601 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans