Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Filter setting problem in job queue

(0) ShareShare
ReportReport
Posted on by 1,893

Dear Experts,

I have created a report, which show the customer masters with some details. Actually, we want to track the how many customer created in last month. We want to run it on every month of the starting date for example 1st august 2018. Report would show the customers created in July month. I am facing problem to write the filter in my report for get the data for last month record. I want to run it through job queue. Please help to resolve my filter problem.

My code is below.

OnRun()

PdfDocPath :='CustomerMaster.pdf';
Path := 'C:\Temp\'+PdfDocPath; // Directory + Path
//Customer.SetFilters(FORMAT(CALCDATE('<-1M>',TODAY)));
CLEAR(CustomerMaster); // CustomerMaster is a Report 50120
CustomerMaster.USEREQUESTPAGE(FALSE); 
IF NOT CustomerMasterMKU.SAVEASPDF(Path) THEN
ERROR('PDF Creating Failed!\\ERROR:\\' + GETLASTERRORTEXT);
SmtpMail.CreateMessage('XYZ Limited','NAV@xyz.com','abc@test.com','Customer Details:','',TRUE);
SmtpMail.AppendBody('Dear Sir / Madam,');
SmtpMail.AppendBody('<br><br>');
SmtpMail.AppendBody('Please Find The Customer Details in PDF Format:');
SmtpMail.AppendBody('<br><br>');
SmtpMail.AppendBody('Regards');
SmtpMail.AppendBody('<br>');
SmtpMail.AppendBody('Accounts Departments ');
SmtpMail.AddAttachment(Path,PdfDocPath);
SmtpMail.Send;
ERASE(Path);

*This post is locked for comments

  • manish.yadav Profile Picture
    1,893 on at
    RE: Filter setting problem in job queue

    Thank you for fastl reply sir.

    Please provide me the syntex for apply the last one month data. I am unable to write the filter.

    In customer card there have a field "Creation Date Time". where have saved the both date and time. Please help me sir.

  • ManishS Profile Picture
    80 on at
    RE: Filter setting problem in job queue

    If its fixed that you want to execute report for last month, then I would suggest to put that date filter on the report it self on PreReport or PreDataitem trigger.

    Assuming the above code is written in code unit to call the report.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Community Member Profile Picture

Community Member 108

#2
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#3
manish.yadav Profile Picture

manish.yadav 6

Featured topics

Product updates

Dynamics 365 release plans