hi all...
i want to gather a group of record from "item ledger entry" table whose "Posting Date" field is not later than work date..
mean..if workdate = '06/12/06' then all record must be after workdate. that is '07/12/06', or '08/12/06'....
so how to setrange for "Posting Date"
i tried to do tis but can't work.
setrange("Posting Date", '010100..%1',workdate);
setfilter("Posting Date", '010100..%1',workdate);
how to do setrange for date tat meet my criteria...????
0
Comments
SETRANGE("Posting Date",0D,workdate); // Up to a date
SETRANGE("Posting Date",FromDate,311299D); // From a date
Others are:
SETRANGE("Posting Date",workdate); // Just for one day
SETRANGE("Posting Date",FromDate,ToDate); // From a date to a Date
SETFILTER('%1|%2..%3',ThisDate,Fromdate,ToDate); //This day or That Day to another day
In the help there is also a &, although I have never used it in 10 years :shock:
SETFILTER('%1&%2..%3',ThisDate,Fromdate,ToDate); //This day and That
SETFILTER('%1&%2',FirstDate,SecondDate); // This day and That Day
Thinks thats will do you for a start!
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Which is better or quicker :?:
SETRANGE("Posting Date",WORKDATE+1,311299D);
SETFILTER("Posting date",'>%1',WORKDATE);
:roll:
I think the difference in filtering is not noticable!
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
eg:
setfilter("Posting Date",'%1..',workdate);
Anyways...10s for ur info...
God bless u~~
No, there is not problem with performance, but with simplicity of code to be able to read it and understand it quickly... 8)
and SETRANGE("Posting Date",WORKDATE+1,311299D); will not work, because 311299 = 31.12.1999
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Yep your right it should be 31129999D not 311299D
31129999D is used in Navision's own code for 31 December 9999
Codeunit 11 Gen. Jnl.-Check Line for example.
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
In your post you said
This includes the workdate does it not :?:
setfilter("Posting Date",'%1..',workdate);
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
if you want 31.12.9999 you must use 31129999D -> it is same as when you enter it into date field on form...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Yep I just changed my other post! :oops:
But if you put in 01012006D then Navision chops it to 010106D when it compiles.
So what happens in 2106?, not that I will be around to worry
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Check this out as well
https://rockwithnav.wordpress.com/2016/06/04/send-sms-dynamics-nav/
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/