web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to set the month filter?

(0) ShareShare
ReportReport
Posted on by 1,893

Dear Experts,
I have a report in NAv 2013. I have develop a function to send it by email with in pdf format. Code is below. Here, I am unable to set the date range for this report. In every month, this report will shoot through the job queue. I am getting error when I am running it. Kindly advise. 

1616.uu.png

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: How to set the month filter?

    In your program you can set date filter like this

    "G/L Account ".SETRANGE("Date Filter",TODAY,TODAY);

  • manish.yadav Profile Picture
    1,893 on at
    RE: How to set the month filter?

    Dear Sir,

    currently I am using the below code but there is no result:

    IF WORKDATE=CALCDATE('<CM>',TODAY)  THEN BEGIN

    PdfDocPath :='MKUShyamNagarLedgerDetails.pdf';

    Path := 'C:\Temp\'+PdfDocPath; // Directory + Path

    CLEAR(MKUShyamNagarLedgerDetails); // MKUShyamNagarLedgerDetails is a Report 50088

    MKUShyamNagarLedgerDetails.USEREQUESTPAGE(FALSE);          //// for filteration

    IF NOT MKUShyamNagarLedgerDetails.SAVEASPDF(Path) THEN

    ERROR('PDF Creating Failed!\\ERROR:\\' + GETLASTERRORTEXT);

    SMTpMail.CreateMessage('MKU Limited','NAV@mku.com','manish.yadav@mku.com','Ledger Details:','',TRUE);

    SMTpMail.AppendBody('Dear Sir / Madam,');

    SMTpMail.AppendBody('<br><br>');

    SMTpMail.AppendBody('Please Find The Ledger Details in PDF Format:');

    SMTpMail.AppendBody('<br><br>');

    SMTpMail.AppendBody('Regards');

    SMTpMail.AppendBody('<br>');

    SMTpMail.AppendBody('MKU Accounts Departments ');

    SMTpMail.AddAttachment(Path);

    SMTpMail.Send;

    ERASE(Path);

    END;

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: How to set the month filter?

    I think you have problem in report mo 50088 wherein actually details are fetched in PDF

    Kindly check

  • Verified answer
    Binesh Profile Picture
    7,885 on at
    RE: How to set the month filter?

    Hello Manish,

    Check your Report 50088, In that report need Date filter. But in your code you didn't pass date filter.

    Do some changes in your code, and pass the date filter first before running/Saving the report.

  • manish.yadav Profile Picture
    1,893 on at
    RE: How to set the month filter?

    Dear Sir,

    Is there any way I can set the auto filter in report that when I generate the report....

    the result should come from last one month from including current date...

    Date filter is blank in report...so when I run the particular codeunit...always it is asking for the date filter...

    Please advice me.

  • Verified answer
    PachaDie Profile Picture
    50 on at
    RE: How to set the month filter?

    Hello!,

    Add a new function in order to set parameters on report.

    In your code:

    CLEAR(MKUShyamNagarLedgerDetails); // MKUShyamNagarLedgerDetails is a Report 50088

    MKUShyamNagarLedgerDetails.NewFunction(Date1,Date2);  //Setting Dates parameters

    MKUShyamNagarLedgerDetails.USEREQUESTPAGE(FALSE);          //// for filteration

    In Report

    ...

    On-PreDataItem

    Setrange(Parm1,Param2);

    ...

    Regards

  • manish.yadav Profile Picture
    1,893 on at
    RE: How to set the month filter?

    Now, the problem are resolved. I have set the filter in report trigger.(On-PreDataItem).

    Data is verified. Thank you all.

    I have been able to solve this issue. Please close this incidents.

    Many thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans