Options

SETSELECTIONFILTER not working correctly in 2015

rocatisrocatis Member Posts: 163
edited 2015-07-22 in NAV Three Tier
I'm using build 38798.

Try importing these two pages and running page 91000:
OBJECT Page 91000 Main Page
{
  OBJECT-PROPERTIES
  {
    Date=22-07-15;
    Time=14:53:39;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    Editable=No;
    SourceTable=Table2000000026;
    SourceTableView=WHERE(Number=FILTER(1..5));
    PageType=List;
    ActionList=ACTIONS
    {
      { 1160180004;  ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 1160180005;1 ;Action    ;
                      Name=Count Sub Page as Group;
                      OnAction=VAR
                                 integer@1160180000 : Record 2000000026;
                               BEGIN
                                 CurrPage.SubPageAsGroup.PAGE.GetRecords(integer);
                                 MESSAGE('Main Page Count: %1',integer.COUNT);
                               END;
                                }
      { 1160180009;1 ;Action    ;
                      Name=Count Sub Page as FactBox;
                      OnAction=VAR
                                 integer@1160180000 : Record 2000000026;
                               BEGIN
                                 CurrPage.SubPageAsFactBox.PAGE.GetRecords(integer);
                                 MESSAGE('Main Page Count: %1',integer.COUNT);
                               END;
                                }
    }
  }
  CONTROLS
  {
    { 1160180000;0;Container;
                ContainerType=ContentArea }

    { 1160180001;1;Group  ;
                Name=Group;
                GroupType=Repeater }

    { 1160180002;2;Field  ;
                SourceExpr=Number }

    { 1160180006;1;Group  ;
                GroupType=Group }

    { 1160180008;2;Part   ;
                Name=SubPageAsGroup;
                PagePartID=Page91001;
                PartType=Page }

    { 1160180007;0;Container;
                ContainerType=FactBoxArea }

    { 1160180003;1;Part   ;
                Name=SubPageAsFactBox;
                PagePartID=Page91001;
                PartType=Page }

  }
  CODE
  {

    BEGIN
    END.
  }
}

OBJECT Page 91001 Sub Page
{
  OBJECT-PROPERTIES
  {
    Date=22-07-15;
    Time=14:47:09;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    Editable=No;
    SourceTable=Table2000000026;
    SourceTableView=WHERE(Number=FILTER(1..5));
    PageType=ListPart;
    OnAfterGetCurrRecord=BEGIN
                           // bug fix
                           // https://community.dynamics.com/nav/b/vikosnavblog/archive/2014/09/04/bug-in-nav-2013-r2-preventing-correct-execution-of-getrecord-setselectionfilter-and-it-39-s-workaround
                         END;

    ActionList=ACTIONS
    {
      { 1160180003;  ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 1160180004;1 ;Action    ;
                      Name=Sub Page Count;
                      OnAction=VAR
                                 integer@1160180000 : Record 2000000026;
                               BEGIN
                                 GetRecords(integer);
                               END;
                                }
    }
  }
  CONTROLS
  {
    { 1160180000;0;Container;
                ContainerType=ContentArea }

    { 1160180001;1;Group  ;
                Name=Group;
                GroupType=Repeater }

    { 1160180002;2;Field  ;
                SourceExpr=Number }

  }
  CODE
  {

    PROCEDURE GetRecords@1160180000(VAR _integer@1160180000 : Record 2000000026);
    BEGIN
      CurrPage.SETSELECTIONFILTER(_integer);
      MESSAGE('Sub Page Count: %1',_integer.COUNT);
    END;

    BEGIN
    END.
  }
}

What you will see are a main page and two sub pages which are actually the same page (91001). Only difference is that one is a sub page and the other is a fact box.

The sub page returns correct counts, also when using Ctrl+A or clicking in the left corner of the list. The fact box, however, does not.

The question is if anybody has found a workaround or know of a working build.
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
Sign In or Register to comment.