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

Announcements

News and Announcements icon
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

I have the same question (0)
  • ManishS Profile Picture
    86 on at

    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.

  • manish.yadav Profile Picture
    1,893 on at

    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.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans