web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Tina Menezes Blog / Procedure to create a date ...

Procedure to create a date range filter on request page of an object in Dynamics NAV

Tina Menezes Profile Picture Tina Menezes 2,582

Introduction: In customized reports of NAV, often the records have to be filtered by specifying a date filter range. For example if we enter ‘012318..032118’, the records from the respective table should be filtered which are falling in the range between January 23rd,2018 to March 21st, 2018 and the filtered records will be fetched and displayed. My system date is in the format MM/dd/yyyy. Hence, I have entered it in the same way.

In this article, I will be giving the procedure to create a date range filter in request page of an XML port to filter and display respective records.

Pre-Requisite:

Microsoft Dynamics NAV

Procedure:

  1. In C/AL globals, create 2 variables as below: (a) Variable of ‘Text’ datatype to enter the date range filter in request page which is named as ‘PeriodVar’. (b) Variable of ‘Codeunit’ datatype and subtype ‘ApplicationManagement’ which is Codeunit 1 which is named as ‘ApplicationMgtCodeunit’.

image001

  1. Add the newly created variable ‘PeriodVar’ to the request page of the XMLport.

image003

  1. Navigate to the OnPreXMLItem() trigger of the table in the XMLport.

image005

  1. Add the following C/AL code to filter the records according to the entered date range. You need to use the MakeDateFilter(VAR DateFilterText : Text[1024]) function present in ApplicationManagement codeunit.

image007

  1. Save and run the XMLport and enter the date range filter in request page of the XMLport as shown below.

image009

Note: Always enter date range filter in the above format i.e. ‘StartDate..EndDate’. You need to check your system date format and enter date range accordingly.

Thus, the records from Detailed GST Ledger Entry which fall in between January 24th, 2018 and June 20th, 2018 will be filtered and displayed.

image010

Thank you!

 


This was originally posted here.

Comments

*This post is locked for comments