Redigera

Dela via


Page.SetRecord(var Record) Method

Version: Available or changed with runtime version 1.0.

Sets the current record for the page.

Syntax

 Page.SetRecord(var Record: Record)

Parameters

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

Record
 Type: Record
The record to set as the current record. You cannot use a temporary record for the Record parameter.

Remarks

You can use this method to set the record to display when the user opens the page.

Example

The following example retrieves the record that has a primary key value of ‘30000’ from the Customer table. If the record is found, it is stored in the MyRecord variable. The SetRecord method uses the retrieved record as the current record and sets record for MyPage, which is a Customer Card page. When the code unit is run, the record is displayed on the MyPage page. If the record is not found, a message box displays a message that indicates that the record was not found.

 var
    MyPage: Page "Customer Card";
    MyRecord: Record Customer;
    Text000: Label 'The record was not found';
begin
    if MyRecord.Get('30000') then begin  
      MyPage.SetRecord(MyRecord);  
      MyPage.Run;
    end else begin
      Message(Text000);  
    end;  
end;

Page Data Type
Get Started with AL
Developing Extensions