Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I'm trying to apply filters to a custom report. I'm struggling with Date filter as range. In the past what I have done is create two global variables: StartDate and EndDate both as Date variables. Then I simply apply a SETRANGE filter: SETRANGE("POSTIND DATE", StartDate, EndDate) and that works ok.
However, NAV 2013 R2 has this behavior where you can simply tipe 01052015..31052015 and it will apply a date format. That what I'm tryint to accomplish. I already know that I would have to use SETFILTER instead of SETRANGE to start with.
Any suggestions or any directions to the right place would be greatly appreciated.
If you want to use that format you have to use SETFILTER
Thank you for your answer Suresh, what I'm trying locates on the request page. Below more detail information.
As you can see in the picture above, I'm trying to type the dates in range like 01052015..31052015 to only request one input from the user. This to avoid having multiple boxes asking just for dates.
If I do this on the G/L Register page i get this:
Navision complety understand that I have input two dates. That what I'm trying to accomplish if possible.
What is the source expression for the Request page Date Filter, is it a variable if so what is the datatype ? If the data type is Date then it should be good, i think there may be validation added on the validation of the field on the request page to check the format. Please check if there is any code.
Please check the Data type of the Dates variable. It should be of Type Text and you have to use GETRANGEMIN and GETRANGEMAX functions to get those range of dates.
You should find a specific function in codeunit 1 specifically designed for this:
Check this code:
FormatTextDateFilter(TxtDate : Text)AppMgt.MakeDateFilter(TxtDate);
I keep getting an error when I try your solution...
I'm using NAV 2013 R2 and using NAV Development Enverironment to design my Reports. This is what I have done so far,
Declared a Global Varible under C/AL GLobals called TxtDates wich is a text DataType with a length of 50
On my request page I have reference this Global variable as a field Type...
Finally, I go into the C/AL code for the request page and type your code
and thats when I get the error. I'm sorry if not making any sence and not understanding your answer. I have been working with NAV Development Environment for two weeks now. Thanks for taking time out of your day to help out.
Did you try without using Codeunit 1?
Just a text variable and insert the date.
get the dates using GETRANGEMIN and GETRANGEMAX ?
FormatTextDateFilter is a function I created. You can use the code inside it. If you want to use the name of the function that works too :)
This way TxtDate can have the value '010101..311201' and it will be transformed to what you expect.
Let me attach a screenshot with the example:
Call the function from the object:
Source Expression = FORMAT(gFromDate)+'..'+FORMAT(gToDate) Try to it
Hi Prabakaran Joy,
Assuming the gToDate is the field of type Text, so you'll need to break the string using
TempString := CONVERTSTR(gToDate,'..','); //Break the string by '..'
FromDate:= SELECTSTR(1,TempString); //Get the string before '..'
ToDate := SELECTSTR(2,TempString); //Get the string after '..'
FromDate := FromDate+'D'; //Append 'D'
ToDate := ToDate+'D'; //Append 'D'
//Filter such as 01012018D..01032018D
Record.Setfilter("Posting Date",'%1',"Posting Date);
You can now enter the date ranges i.e 01052015..31052015 in the "Posting Date".
Business Applications communities