FilterPageBuilder.AddRecord(Text, Record) Method

Version: Available or changed with runtime version 1.0.

Adds a filter control for a table to a filter page. The table is specified by a record data type variable that is passed to the method.

Syntax

[Name := ]  FilterPageBuilder.AddRecord(Name: Text, Record: Record)

Parameters

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

Name
 Type: Text
Assigns a name to the filter control for the table. The text displays as the caption for the filter control on the rendered filter page in the client.

Record
 Type: Record
The record to use in the filter control.

Return Value

[Optional] Name
 Type: Text
The text that is specified by the Name parameter. If an error occurs at runtime, an empty text string is returned. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

In the filter page that is rendered in the client, the AddRecord method defines a filter control for the specified table where the user can set filters on specific fields in the table.

Fields in the table that already have filters are automatically included in the filter control. Filters in the record passed to the method will not be modified by any method in the FilterPageBuilder object.

Example

The following example initializes a filter page object that includes a filter control that uses the Date system table. The filter control has the caption of Date record. The example set two filters are on the Date record variable, which results in a filter control that includes two fields by default.

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

begin
    varDateItem := 'Date record';  
    varDateRecord.SetFilter("Period End",'12122015D');  
    varDateRecord.SetFilter("Period Start",'01012015D');  
    varFilterPageBuilder.AddRecord(varDateItem, varDateRecord);
    varFilterPageBuilder.RunModal(); 

end;

See Also

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