FilterPageBuilder.AddRecordRef(String, RecordRef) 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 RecordRef variable that is passed to the method. This creates a filter control on the filter page, where users can set filter table data.

Syntax

[Name := ]  FilterPageBuilder.AddRecordRef(Name: String, RecordRef: RecordRef)

Parameters

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

Name
 Type: String
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.

RecordRef
 Type: RecordRef
The record reference to use in the filter control.

Return Value

[Optional] Name
 Type: String
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 AddRecordREF method defines a filter control for the specified table where the user can add and set the filters on the table.

Fields in the table that already have filters are automatically included in the filter control. Filters in the record reference 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;  
    varDateRecordRef: RecordRef;  
    varFilterPageBuilder: FilterPageBuilder;  

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

See Also

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