Modifier

Partager via


Page.SetSelectionFilter(var Record) Method

Version: Available or changed with runtime version 1.0.

Notes the records that the user has selected on the page, marks those records in the table specified, and sets the filter to "marked only".

Syntax

 Page.SetSelectionFilter(var Record: Record)

Parameters

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

Record
 Type: Record

Remarks

If all records are selected, marks will not be used.

If only the current record is selected on the page, then SetSelectionFilter does the following:

  • Sets the current filter group to 0 on the destination record
  • Adds filters on the primary key fields that point to the current record of the page

If more than one record is selected on the page, then SetSelectionFilter does the following:

  • Copies the current key from the page source table to the destination record
  • Copies the current sort order from the table to the destination record
  • Copies the current filters that are set in all filter groups
  • Copies the current filter group
  • Marks the selected records and sets the "marked only" filter

Example

The following example shows how to use the SetSelectionFilter method to update the record or records from the Contact table that the user has selected on the current page.

var
    Contact: Record Contact;
    CRMIntegrationManagement: Codeunit "CRM Integration Management";
    ContactRecordRef: RecordRef;
begin
    CurrPage.SetSelectionFilter(Contact);
    Contact.Next;

    if Contact.Count = 1 then
        CRMIntegrationManagement.UpdateOneNow(Contact.RecordId)
    else begin
        ContactRecordRef.GetTable(Contact);
        CRMIntegrationManagement.UpdateMultipleNow(ContactRecordRef);
    end;
end;

Page Data Type
Get Started with AL
Developing Extensions