How to filter by year? HELP

Becka
Member Posts: 178
Hi all! 
So... I need to filter information in table by year.. For example: there is a field in table Posting date and i need to filter it only by year>>
14/12/07 that's the value of it, and i wanna filter it by 2007..
If any ideas, just help..
Thanks to all

So... I need to filter information in table by year.. For example: there is a field in table Posting date and i need to filter it only by year>>
14/12/07 that's the value of it, and i wanna filter it by 2007..
If any ideas, just help..

Thanks to all

MCSD
Attain Navision
Attain Navision
0
Answers
-
You mean to set filter like "01/01/07..31/12/07"? 8) This will filter the year for you...0
-
nope, you got it wrong..
for example: information in table:
Posting date:
01/01/07
05/09/07
25/06/08
and i wanna filter it only by year, for example i need to filter it by 2007.. you see?MCSD
Attain Navision0 -
I think you should try to apply what Kamil suggested.
When you use "01/01/07..31/12/07" this will filter the year for you..
Or explain the problem a bit more.
Tino Ruijs
Microsoft Dynamics NAV specialist0 -
:-k
okay.. i have table A, and there's field named as year(text type:2006,2007,2008 and s.o.).. And i need to take the meaning of that year field and set filter on the table B.. But the case is, i can set the filter on the B table's field "Posting Date", i have a problem, "Posting Date" is a date type field, and i wanna set the filter on it by A table's field year... So if any ideas, just go ahead..MCSD
Attain Navision0 -
Ok.
You can use functions that you can find in the C/AL Symbol Menu.
SYSTEM, DATE, DMY2DATE.
SETRANGE(date, DMY2DATE(1, 1, year), DMY2DATE(31, 12, year);
Tino Ruijs
Microsoft Dynamics NAV specialist0 -
Becka wrote::-k
okay.. i have table A, and there's field named as year(text type:2006,2007,2008 and s.o
By the way. To use the function DMY2DATE, year needs to be an integer.
So it's better to define year as integer.
When that's not possible anymore use EVALUATE(intYear, txtYear); to turn your text into integer.
Tino Ruijs
Microsoft Dynamics NAV specialist0 -
Becka wrote::-k
okay.. i have table A, and there's field named as year(text type:2006,2007,2008 and s.o.).. And i need to take the meaning of that year field and set filter on the table B.. But the case is, i can set the filter on the B table's field "Posting Date", i have a problem, "Posting Date" is a date type field, and i wanna set the filter on it by A table's field year... So if any ideas, just go ahead..
Try to think about it. What is Year? Year is everything between 1st of January and 31st of December, isn't it? If yes, filtering for year 2007 means filtering everything with date 1/1/07 to 31/12/07. And it is what I wrote. Forgot about "text filtering". If the date is saved as text, you can filter like "*/07". If it is date, you need to filter the whole year period by "1/1/07..31/12/07". If you do not know how to calc the limit dates, you can useStartOfTheYear := CALCDATE('<-CY>',AnyDateWithinYear); EndOfTheYear := CALCDATE('<+CY>',AnyDateWithinYear);
0 -
int MyYear;
......
DMY2DATE(1,1,MyYear)..DMY2DATE(31,12,MyYear);
That's part of my code... It's really works..MCSD
Attain Navision0
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