FilterPageBuilder.SetView(Text, Text) Method

Version: Available or changed with runtime version 1.0.

Sets the current filter view, which defines the sort order, key, and filters, for a record in a filter control on a filter page. The view contains all fields that have default filters, but does not contain fields without filters.

Syntax

[Ok := ]  FilterPageBuilder.SetView(Name: Text, View: Text)

Parameters

FilterPageBuilder
 Type: FilterPageBuilder
An instance of the FilterPageBuilder data type.

Name
 Type: Text
The name that is assigned to 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.

View
 Type: Text
The filter view to apply. This can be the output of the GetView method invoked on a Record or a RecordRef value.

Return Value

[Optional] Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

The SetView method will overwrite any previously defined filters for the fields that are also included in the view.

Example

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 filter fields to the filter control on the filter page as the result of applying a default view from the GetView Method.

var
    varDateItem: Text[30];  
    varDateRecord: Record Date;  
    varFilterPageBuilder: FilterPageBuilder;  
    varDefaultView: Text;  

begin
    varDateItem := 'Date record';  
    varDateRecord.SetFilter("Period End", '20151212D');  
    varDateRecord.SetFilter("Period Start", '20150101D');  
    varDefaultView := varDateRecord.GetView;  
    varFilterPageBuilder.AddTable(varDateItem, Database::Date);  
    varFilterPageBuilder.SetView(varDateItem, varDefaultView);
    varFilterPageBuilder.RunModal();
end; 

See Also

FilterPageBuilder Data Type
Creating Filter Pages for Tables
Get Started with AL
Developing Extensions