2009 R2 Classic reports -

jonesks
Member Posts: 29
Hi. I need to add a permanent filter to a report - so that the report only picks up records where the due date for an invoice is within the current month and it is in the open state. I am very new to NAV and have been trying to use CM for current month - but it doesn't like it.
Any pointers would be appreciated.
Any pointers would be appreciated.
0
Best Answers
-
In the preDataItem put this:
DateREC.RESET; // DateRec is a record on virtual table "Date"
DateREC.SETRANGE("Period Type",DateREC."Period Type"::Month);
DateREC.SETFILTER("Period Start",'..%1',DMY2DATE(1,DATE2DMY(TODAY,2),DATE2DMY(TODAY,3)));
DateREC.FINDLAST;
FILTERGROUP(10); // necessary to avoid that user puts another filter on it and only 1 of them is taken
// Putting it in another filtergroup makes sure both filters are used
SETFILTER("Due date",DateREC."Period Start",DateREC."Period End");
FILTERGROUP(0);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!5 -
Setrange("Due Date",calcdate('<-CM>',workdate),calcdate('<+CM>',workdate));5
Answers
-
In the preDataItem put this:
DateREC.RESET; // DateRec is a record on virtual table "Date"
DateREC.SETRANGE("Period Type",DateREC."Period Type"::Month);
DateREC.SETFILTER("Period Start",'..%1',DMY2DATE(1,DATE2DMY(TODAY,2),DATE2DMY(TODAY,3)));
DateREC.FINDLAST;
FILTERGROUP(10); // necessary to avoid that user puts another filter on it and only 1 of them is taken
// Putting it in another filtergroup makes sure both filters are used
SETFILTER("Due date",DateREC."Period Start",DateREC."Period End");
FILTERGROUP(0);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!5 -
HI. Thanks for the answer. Unfortunately when I save it - I get you have specified an unknown variable - DateRec. Define the variable under Global C/AL symbols.
Sorry as I said in my original post very new to C/SIDE and C/AL!0 -
This is what I have so far - all three filters are working - but the Due date is currently set to not blank. I need to set this to within the same month as the current work date. I cannot find the correct syntax anywhere.
Cust. Ledger Entry - OnPreDataItem()
SETFILTER("OPEN",'YES'); //filter to pick up only open documents
SETFILTER("Document Type",'Invoice'); //filter to pick up only Invoices - not credit notes or payments
SETFILTER("Due Date", ''); //filter to ensure Due date is within the current month - at moment just blank.0 -
Setrange("Due Date",calcdate('<-CM>',workdate),calcdate('<+CM>',workdate));5
-
Ignore the above - I had declared the variable but I had managed to not save it! - Being a bit thick Sorry!
Thanks for the code!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions