FilterPageBuilder.AddField(String, FieldRef [, String]) Method
Version: Available or changed with runtime version 2.0.
Adds a table field to the filter control for a table on filter page.
[Ok := ] FilterPageBuilder.AddField(Name: String, Field: FieldRef [, Filter: String])
The name that is assigned to the table in the filter control. This value must match the value of the Name 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. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
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.
var varDateItem: Text; varDateRecord: Record Date; varFilterPageBuilder: FilterPageBuilder; begin varDateItem := 'Date record'; varFilterPageBuilder.AddRecord(varDateItem, varDateRecord); varFilterPageBuilder.AddField(varDateItem, varDateRecord."Period End",'12122015D'); varFilterPageBuilder.AddField(varDateItem, varDateRecord.); varFilterPageBuilder.RunModal(); end;