Monday 7 November 2016

New DataType FILTERPAGEBUILDER - Navision 2016

Hello Everyone,

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.
Following is an example how it can be used
Sample Code:
Variable - 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

Resulting Output

Filter Page


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.


Filter Page


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.


Example:

Customer2.SETVIEW(FilterPageBuilder.GETVIEW(Customer));

Where Customer2 is another customer record variable.


And its done.

Hope this helps.