Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to set the month filter?

Posted on by 1,835

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

  • manish.yadav Profile Picture
    manish.yadav 1,835 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.

  • Verified answer
    PachaDie Profile Picture
    PachaDie 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
    manish.yadav 1,835 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
    Binesh Profile Picture
    Binesh 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.

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 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

  • manish.yadav Profile Picture
    manish.yadav 1,835 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;

  • Verified answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 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);

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans