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:
- 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’.

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

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

- 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.

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

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.

Thank you!

Like
Report
*This post is locked for comments