The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
Adds a table field to the filter control for a table on filter page.
[Ok :=] FilterPageBuilder.ADDFIELD(ItemName, Field[,Filter])
The name that is assigned to the table in the filter control. This value must match the value of the ItemName parameter that was specified by ADDTABLE, ADDRECORD, or ADDRECORDREF method that adds the table to the filter control.
The name of the table field to add to the filter control for a table.
A default filter on the field that is specified by the Field parameter.
True if the field was added to the field list for the specified filter control; otherwise, false.
The filter control that specified by ItemName parameter must already exist in the FilterPageBuilder object before the ADDFIELD method is called. This means that either the ADDTABLE, ADDRECORD, or ADDRECORDREF methods must be called before the ADDFIELD method.
If the filter page implementation will call a SETVIEW method, then the SETVIEW method must be called before the ADDFIELD method call, otherwise the filter that is specified by the Filter parameter will be cleared by SETVIEW.
The filter that is specified by the Filter parameter will overwrite any previously defined filters for the field which were set by ADDVIEW method or read from the record or recordRef instance that defined the filter control.
The following example initializes a filter page object that includes a filter control for the Date system table. The filter control has the caption of Date record. The example adds two fields of the Date record variable which will be available in the filter control on the filter page: Period End and Period Start. A default filter is set on the Period End field.
This example requires that you create the following global variables.
varDateItem := 'Date record'; varFilterPageBuilder.ADDRECORD(varDateItem, varDateRecord); varFilterPageBuilder.ADDFIELD(varDateItem, varDateRecord."Period End",'12122015D'); varFilterPageBuilder.ADDFIELD(varDateItem, varDateRecord."Period Start");
GETVIEW Method (FilterPageBuilder)
COUNT Method (FilterPageBuilder)
NAME Method (FilterPageBuilder)
RUNMODAL Method (FilterPageBuilder)