Bearbeiten

Freigeben über


Record.AddLoadFields([Any,...]) Method

Version: Available or changed with runtime version 6.0.

Specifies 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 := ]  Record.AddLoadFields([Fields: Any,...])

Parameters

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

[Optional] Fields
 Type: Any
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

It is not necessary to include the following fields, because they are always selected for loading: Primary key, SystemId, and data audit fields (SystemCreatedAt, SystemCreatedBy, SystemModifiedAt, SystemModifiedBy).

Depending on the runtime version, the runtime may require extra fields to be selected for loading. Which extra fields to specify depends on the state of the record and table or table extension definition. For example, fields that are filtered upon are always loaded.

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

Example

The following example code shows how to use the AddLoadFields method to add a field for loading on a report. The example loads a field that is outside of the default fields selected by DataColumns of the report. The field is added by using the AddLoadFields on the OnPreDataItem trigger.

trigger OnPreDataItem()
begin
    CurrencyDataItem.AddLoadFields("ISO Numeric Code");
end;

trigger OnAfterGetRecord()
begin
    if CurrencyDataItem."ISO Numeric Code" <> 'DKK' then
        CurrReport.Skip();
end;

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