SetFilter, DateTime
nara
Member Posts: 37
I am not very experienced in Navision, I need som help with a codeunit.
I am trying to get som item from item table and I will use the follwing filter
ItemRecord.SETFILTER("Last Date Modified", '>'+ Value);
If I send a Date (dd.mm.yyyy) as Value it will be OK but if I try to send a DateTiime( dd.mm.yyyy hh:mm:ss ) so it will not work.
How can I filter for DateTime?
Best Regards
Nasser
I am trying to get som item from item table and I will use the follwing filter
ItemRecord.SETFILTER("Last Date Modified", '>'+ Value);
If I send a Date (dd.mm.yyyy) as Value it will be OK but if I try to send a DateTiime( dd.mm.yyyy hh:mm:ss ) so it will not work.
How can I filter for DateTime?
Best Regards
Nasser
0
Comments
-
You could use Date := DT2DATE(Datetime) and then use Date to filter your Date.
Tino Ruijs
Microsoft Dynamics NAV specialist0 -
The SETFILTER will be something like this:
ItemRecord.SETFILTER("Last Date Modified",'>%1',DT2DATE(DateTime));
or
ItemRecord.SETFILTER("Last Date Modified",'%1..',DT2DATE(DateTime));
The first does NOT include the date itself of "DateTime" and the second command DOES include the date.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I have another novice/stupid question.
My Value parameter is Text[250], How can I convert to date time
Is there any function that can do this for me
If I use the following line, I will get error message in compile time
ItemRecord.SETFILTER("Last Date Modified",'%1..',DT2DATE(Value));
I mean is there any function like SQL Convert(DateTime, String, ....
Best regards
Nasser0 -
Hi Nasser,
Ths function you need is format( dateVariable );
This is the simplest way to use the format command which can be used for more complex formatting of strings. Look it up on the Help->C/SIDE Reference Guide
Don't worry we all had to learn at the start
P.S. The reverse function i.e. from string to variable is EVALUATE - it took me a long time to find this when I started0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 326 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
