We are new to NAV 2015 and query building. I built a simple query on the sales invoice header table. We want to see all orders posted this month grouped by salesperson. One of the fields selected is the Posting_Date field. I need to filter this field starting with the first day of the current month. I don't see an option to do that on the column filter. The option for C/AL Globals is greyed out.
So I tried the following code in the OnBeforeOpen () level: SETFILTER(Posting_Date, >=CALCDATE('CM-1M+1D', Today));
The code fails with "A value or expression was expected". What am I missing? Is there a better way to handle this?
Thank you
0
Comments
https://msdn.microsoft.com/en-us/library/dd354919.aspx
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
SETFILTER("Posting_Date", %1, >=CALCDATE('<CM-1M+1D>',TODAY));
Now I'm getting a syntax error. The MSN sample shows a Record.SetFilter syntax, but because this is a query, I'm not clear on how to put the record part in. When I look at the list, the first value is CurrQuery. The value for the DataItem, which is the sales invoice line, isn't listed.
The best part...we've made the add-on ABSOLUTELY FREE for all NAV 2015+ users until January 31, 2016. Contact info is on the website if you're interested.
I'll reply to your filter issue separately below.
http://www.epimatic.com
SETFILTER("Posting Date", '>=%1', CALCDATE('<CM-1M+1D>',TODAY));
(You may want to use WORKDATE rather than TODAY depending on how you want to support dates)
http://www.epimatic.com
http://www.epimatic.com
The correct formula for what you stated you want is <Cx> is the same as <+Cx> and gives you the last day in the period x. <-Cx> gives you the first day of the period.
And concerning the SETFILTER, always remember: The filter expression with all the operators goes to the second parameter. It's type is a string, so use quotes if you use a literal. The values to use in your filter expression follow beginning from the third parameter.