Options

Programatically selecting multiple records in list-page

Chris2402Chris2402 Member Posts: 2
Is there a way to select multiple records in a listpage, programatically with C/AL?
I know I can select a single record with Rec.Mark - but im in need to select a range of consecutive records.

Thnx

Answers

  • Options
    NixPtNixPt Member Posts: 19
    Try something like this, call the function GetSelectionFilter after the user mark the fields
    
    OBJECT Page 70003 xxxx
    {
      OBJECT-PROPERTIES
      {
        Date=17-05-29;
        Time=11:02:17;
        Modified=Yes;
        Version List=#STB01#;
      }
      PROPERTIES
      {
        SourceTable=Table27;
        PageType=List;
        OnOpenPage=BEGIN
                     CLEARMARKS;
                   END;
    
        OnAfterGetRecord=BEGIN
                           Marked := MARK;
                         END;
    
      }
      CONTROLS
      {
        { 1000000000;0;Container;
                    ContainerType=ContentArea }
    
        { 1000000001;1;Group  ;
                    Name=Group;
                    GroupType=Repeater }
    
        { 1000000005;2;Field  ;
                    SourceExpr=Marked;
                    OnValidate=BEGIN
                                 IF Marked THEN
                                   MARK(TRUE)
                                 ELSE
                                   MARK(FALSE);
                               END;
                                }
    
        { 1000000002;2;Field  ;
                    SourceExpr="No." }
    
        { 1000000003;2;Field  ;
                    SourceExpr=Description }
    
        { 1000000004;2;Field  ;
                    SourceExpr="Assembly BOM" }
    
      }
      CODE
      {
        VAR
          Marked@1000000000 : Boolean;
    
        PROCEDURE GetSelectionFilter@1000000000(VAR Item@1000000000 : Record 27);
        BEGIN
          MARKEDONLY(TRUE);
          IF FINDSET THEN
            Item.COPY(Rec);
        END;
    
        BEGIN
        END.
      }
    }
    
    
  • Options
    ta5ta5 Member Posts: 1,164
    Depending on what exactly try to do, you can just use
    CurrPage.SETSELECTIONFILTER(Recordvar)
    

    You can multiselect in any list page, SETSELECTIONFILTER returns the marked records to "RecordVar"
    Hope this helps.
Sign In or Register to comment.