RecordRef.AddLoadFields([Integer,...]) Method

Version: Available or changed with runtime version 6.0.

Specifies additional fields to be initially loaded when the record is retrieved from its data source. Subsequent calls to AddLoadFields will not overwrite fields already selected for the initial load.

Syntax

[Ok := ]  RecordRef.AddLoadFields([Fields: Integer,...])

Parameters

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

[Optional] Fields
 Type: Integer
The FieldNo's of the fields to be loaded.

Return Value

[Optional] Ok
 Type: Boolean
true if all fields are selected for subsequent loads; otherwise, false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

Calling SetLoadFields on a record without passing any fields will reset the fields selected to load to the default, where all readable normal fields are selected for load.

This method is part of the partial records capability for improving performance. For more information, see Using Partial Records.

Example

This code example uses the AddLoadFields method to make sure that if a record is a Currency, then the Currency Factor field is loaded. This code would have to be called before a database operation is executed on the RecordRef.

procedure AlwaysNeededFields(VAR MyRecordRef: RecordRef)
var
        Currency: Record Currency;
begin
if (MyecordRef.Number = Database::Currency) then
// We always want the Currency."Currency Factor"
MyRecordRef.AddLoadFields(Currency.FieldNo(Currency."Currency Factor"));
end;

Using Partial Records
RecordRef Data Type
Get Started with AL
Developing Extensions