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.
1. ADDTABLE
1. ADDRECORD
1. ADDRECORDREF
1. ADDFIELD
1. GETVIEW
1. SETVIEW
1. RUNMODAL
1. COUNT
1. 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
[](http://lh3.googleusercontent.com/-O1304SLlNYc/VhMvuxc3LQI/AAAAAAAAJq0/TXbnFUDLYMY/s1600-h/image%25255B4%25255D.png)
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.
[](http://lh3.googleusercontent.com/-PPSpyJ72gsA/VhMvvxAyqoI/AAAAAAAAJrA/ex62HOIeAvM/s1600-h/image%25255B11%25255D.png)
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.
Leave a comment