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
0
Comments
Tino Ruijs
Microsoft Dynamics NAV specialist
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.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
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
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 started
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html