First and Last Date from a date range filter

colingbradley
Member Posts: 162
I am writing a report and I need to be able to get the first and last date (Min and Max?) from "G/L Entry".GETFILTER("Posting Date")
I need to subtract 2 months from the lowest date and ADD 2 months to the highest date.
Other than putting the dates in the Option tab, I am not sure if this is possible, anyone know?
I need to subtract 2 months from the lowest date and ADD 2 months to the highest date.
Other than putting the dates in the Option tab, I am not sure if this is possible, anyone know?
Experience is what you get when you hoped to get money
0
Comments
-
Hi
You can do the followingFirstDate := CALCDATE('<-2M>',"G/L Entry".GETRANGEMIN("PostingDate")); LastDate := CALCDATE('<+2M>',"G/L Entry".GETRANGEMAX("PostingDate"));
I'm assuming that you have set a date filter on the "Posting Date" field.
Albert0 -
The problem there is that I only have the date range to work with as entered in the filter, 01/10/07..31/10/07
Unless I get the "posting Date" from the first record encountered and use that of course. May have to do that.
This is a bit of a blunt object approach, it is to do with some sales shipment dates at the end of the month and the invoice being posted in the first few days of the next month and reconciling all the shipments within the period back to the G/L. I have no real idea of what the difference is so using a reasonable envelope.
Experience is what you get when you hoped to get money0 -
Sorry, I did not look closely enough at the code, that works a treat.
Just needed to add a space in the "PostingDate"
Many thanks,Experience is what you get when you hoped to get money0 -
Hi
Glad it worked
Albert0 -
It is solved I see, but here is a function what is get the first and last day of a month
GetFirstDayOfMonth(dateValue:Date) : dateFirst : DatedateFirst := DMY2DATE(1,DATE2DMY(dateValue,2),DATE2DMY(dateValue,3));
GetLastDayOfMonth(dateValue:Date) : dateLast : DateIF DATE2DMY(dateValue,2) < 12 THEN dateLast := DMY2DATE(1,DATE2DMY(dateValue,2)+1,DATE2DMY(dateValue,3)) ELSE dateLast := DMY2DATE(1,1,DATE2DMY(dateValue,3)+1); dateLast := CALCDATE('-1D',dateLast);
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