Monday, October 5, 2015

New DataType FILTERPAGEBUILDER in NAV 2016

There is a new datatype introduced in NAV 2016 and it is called FilterPageBuilder, this datatype can be used to create a filter page that enables users to set filters on multiple tables. The page can have multiple controls i.e. multiple records and you can use that to capture filters on the records.
The following are the functions that are available for this datatype.



  • ADDTABLE
  • ADDRECORD
  • ADDRECORDREF
  • ADDFIELD
  • GETVIEW
  • SETVIEW
  • RUNMODAL
  • COUNT
  • NAME
Following is an example how it can be used
FilterPageBuilder ---- SubType of FILTERPAGEBUILDER
FilterPageBuilder.ADDTABLE(‘Customer Table’,DATABASE::Customer);
FilterPageBuilder.ADDTABLE(‘Item Table’,DATABASE::Item);
FilterPageBuilder.RUNMODAL;
The above code will open the following page
image
You can also specify the field like we do using ReqFilterFields property on the request page of the report using ADDFIELD function below is another example
Customer is the record variable of Customer Table
FilterPageBuilder.ADDRECORD('Customer Table',Customer);
FilterPageBuilder.ADDFIELD('Customer Table',Customer."No.");
FilterPageBuilder.RUNMODAL;
As you can see the first parameter should match with ADDRECORD to let the control know which field to show.
image
Once the user sets the filter on the page, we can get the filters from the page using GETVIEW function of the FilterPageBuilder and then set that to another record.
Ex. Customer2.SETVIEW(FilterPageBuilder.GETVIEW(Customer)); Where Customer2 is another customer record variable.
Share:

0 comments: