How-to: Create a One-Page Matrix by Example

Using the step-by-step recipe I have build an example One-Page matrix based on the following requirements:

Customer/Item Spending:

Display the total amount for each item what each of our customers has in order.

Basically this line already reveals the design of our matrix:

  • Display the total amount … -> matrix cells
  • for each item what … -> horizontal dimension
  • each of our customers has in order -> vertical dimension

 To be able to build the matrix I need to do some preparation:

Customer table 

This table needs to be extended with the following three fields (that actualy do the calculations needed for the matrix cells):

Field No.

Field Name

Data Type

Length

Description

62.100

Total Amount

Decimal

 

FlowField: sum of Amount- fields in Sales Line table for customer (incl. next FlowFilters)

62.101

Type Filter

Option

 

FlowFilter for Type field in Sales Line table
OptionString =  ,G/L Account,Item,Resource,Fixed Asset,Charge (Item)

62.102

No. Filter

Code

20

FlowFilter on No. field in Sales Line table

Sales Line table

The following secondary key should be added (to facilitate the FlowField on the Customer table) with Amount field as SumIndexField:

Key

SumIndexFields

Sell-to Customer No.,Type,No.

Amount

Customer/Item Spending Matrix

This One-Page matrix consists of two pages:

  • matrix main  page: 62105 – Customer/Item Spending
  • matrix sub page: 62107 – Customer/Item Spending Matrix

In both objects (were possible) the changes have been marked related to the steps as defined by my step-by-step recipe.

Notes

  • Change markers in the objects have be changed from AMBxxxx (AMB being the acronym for Advanced Matrix Box as mentioned in the Version List of each object) to STEP_x explicitly relating to the steps  as defined by my step-by-step recipe. For reading purposes all occurences of the change markers have colored green.
  • In code below square brackets 6 and 8 are displayed as [6] and [8]

PAG62105

OBJECT Page 62105 Customer/Item Spending

{

  OBJECT-PROPERTIES

  {

    Date=20-04-12;

    Time=12:00:00;

    Version List=Advanced Matrix Box;

  }

  PROPERTIES

  {

    CaptionML=ENU=Customer/Item Spending;

    SaveValues=Yes;

    InsertAllowed=No;

    DeleteAllowed=No;

    ModifyAllowed=No;

    SourceTable=Table18;

    PageType=Card;

    OnOpenPage=BEGIN

                 //STEP_4-BEGIN

                 SetColumns(MATRIX_SetWanted::Initial);

                 //STEP_7-BEGIN

                 UpdateMatrixSubform

                 //STEP_7-END

                 //STEP_4-END

               END;

 

    ActionList=ACTIONS

    {

      { 1900000004;0 ;ActionContainer;

                      ActionContainerType=ActionItems }

      { 31   ;1 ;Action    ;

                      CaptionML=ENU=Previous Set;

                      ToolTipML=ENU=Previous Set;

                      Description=STEP_8;

                      Promoted=Yes;

                      PromotedIsBig=Yes;

                      Image=PreviousSet;

                      PromotedCategory=Process;

                      OnAction=BEGIN

                                 //STEP_8-BEGIN

                                 SetColumns(MATRIX_SetWanted::Previous);

                                 UpdateMatrixSubform

                                 //STEP_8-END

                               END;

                                }

      { 102  ;1 ;Action    ;

                      CaptionML=ENU=Previous Column;

                      ToolTipML=ENU=Previous;

                      Description=STEP_8;

                      Promoted=Yes;

                      PromotedIsBig=Yes;

                      Image=PreviousRecord;

                      PromotedCategory=Process;

                      OnAction=BEGIN

                                 //STEP_8-BEGIN

                                 SetColumns(MATRIX_SetWanted::PreviousColumn);

                                 UpdateMatrixSubform();

                                 //STEP_8-END

                               END;

                                }

      { 103  ;1 ;Action    ;

                      CaptionML=ENU=Next Column;

                      ToolTipML=ENU=Next;

                      Description=STEP_8;

                      Promoted=Yes;

                      PromotedIsBig=Yes;

                      Image=NextRecord;

                      PromotedCategory=Process;

                      OnAction=BEGIN

                                 //STEP_8-BEGIN

                                 SetColumns(MATRIX_SetWanted::NextColumn);

                                 UpdateMatrixSubform();

                                 //STEP_8-END

                               END;

                                }

      { 32   ;1 ;Action    ;

                      CaptionML=ENU=Next Set;

                      ToolTipML=ENU=Next Set;

                      Description=STEP_8;

                      Promoted=Yes;

                      PromotedIsBig=Yes;

                      Image=NextSet;

                      PromotedCategory=Process;

                      OnAction=BEGIN

                                 //STEP_8-BEGIN

                                 SetColumns(MATRIX_SetWanted::Next);

                                 UpdateMatrixSubform

                                 //STEP_8-END

                               END;

                                }

    }

  }

  CONTROLS

  {

    { 1900000001;0;Container;

                ContainerType=ContentArea }

 

    { 12  ;1   ;Group     ;

                CaptionML=ENU=Options }

 

    { 15  ;2   ;Field     ;

                CaptionML=[ENU=Show Column Name;

                           NLD=Kolomnaam weergeven];

                Description=STEP_9;

                SourceExpr=ShowColumnName;

                OnValidate=BEGIN

                             ShowColumnNameOnAfterValidate;

                           END;

                            }

 

    { 33  ;1   ;Part      ;

                Name=MatrixForm;

                Description=STEP_2;

                PagePartID=Page62107;

                PartType=Page }

 

  }

  CODE

  {

    VAR

      MatrixRecord@1000 : Record 27;

      MatrixRecords@1010 : ARRAY [32] OF Record 27;

      MatrixRecordRef@1007 : RecordRef;

      MATRIX_SetWanted@1006 : 'Initial,Previous,Same,Next,PreviousColumn,NextColumn';

      ShowColumnName@1002 : Boolean;

      MATRIX_CaptionSet@1008 : ARRAY [32] OF Text[1024];

      MATRIX_CaptionRange@1011 : Text[100];

      MATRIX_PKFirstRecInCurrSet@1001 : Text[100];

      MATRIX_CurrSetLength@1004 : Integer;

      WshShell@11091689 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell";

 

    PROCEDURE SetColumns@6(SetWanted@1002 : 'Initial,Previous,Same,Next,PreviousColumn,NextColumn');

    VAR

      MatrixMgt@1000 : Codeunit 9200;

      CaptionFieldNo@1001 : Integer;

      CurrentMatrixRecordOrdinal@1003 : Integer;

    BEGIN

      //STEP_4-BEGIN

      CLEAR(MATRIX_CaptionSet);

      CLEAR(MatrixRecords);

      CurrentMatrixRecordOrdinal := 1;

 

      MatrixRecordRef.GETTABLE(MatrixRecord);

      MatrixRecordRef.SETTABLE(MatrixRecord);

 

      //STEP_9-BEGIN

      IF ShowColumnName THEN

        CaptionFieldNo := MatrixRecord.FIELDNO(Description)

      ELSE

      //STEP_9-END

        CaptionFieldNo := MatrixRecord.FIELDNO("No.");

 

      MatrixMgt.GenerateMatrixData(MatrixRecordRef,SetWanted,ARRAYLEN(MatrixRecords),CaptionFieldNo,MATRIX_PKFirstRecInCurrSet,

        MATRIX_CaptionSet,MATRIX_CaptionRange,MATRIX_CurrSetLength);

 

      IF MATRIX_CurrSetLength > 0 THEN BEGIN

        MatrixRecord.SETPOSITION(MATRIX_PKFirstRecInCurrSet);

        MatrixRecord.FIND;

        REPEAT

          MatrixRecords[CurrentMatrixRecordOrdinal].COPY(MatrixRecord);

          CurrentMatrixRecordOrdinal := CurrentMatrixRecordOrdinal + 1;

        UNTIL (CurrentMatrixRecordOrdinal > MATRIX_CurrSetLength) OR (MatrixRecord.NEXT <> 1);

      END;

      //STEP_4-END

    END;

 

    PROCEDURE UpdateMatrixSubform@7();

    BEGIN

      //STEP_7-BEGIN

      CurrPage.MatrixForm.FORM.Load(MATRIX_CaptionSet,MatrixRecords,MatrixRecord);

      //STEP_9-BEGIN

      UpdateThePage

      //STEP_9-END

      //STEP_7-END

    END;

 

    LOCAL PROCEDURE ShowColumnNameOnAfterValidate@8();

    BEGIN

      //STEP_9-BEGIN

      SetColumns(MATRIX_SetWanted::Same);

      UpdateMatrixSubform

      //STEP_9-END

    END;

 

    PROCEDURE UpdateThePage@10();

    BEGIN

      //STEP_9-BEGIN

      IF ISCLEAR(WshShell) THEN

        CREATE(WshShell, TRUE, TRUE);

      WshShell.SendKeys('{F5}');

      //STEP_9-END

    END;

 

    BEGIN

    {

      <changelog>

        <add id="STEP_2"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 2 – One-Page Matrix Step-by-Step</add>

        <change id="STEP_4"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 4 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_7"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 7 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_8"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 8 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_9"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 9 – One-Page Matrix Step-by-Step</change>

      </changelog>

    }

    END.

  }

}

 

 

 

 

 

 

PAG62107

 

 

OBJECT Page 62107 Customer/Item Spending Matrix

{

  OBJECT-PROPERTIES

  {

    Date=20-04-12;

    Time=12:00:00;

    Version List=Advanced Matrix Box;

  }

  PROPERTIES

  {

    Editable=No;

    CaptionML=ENU=Customer/Item Spending Matix;

    SourceTable=Table18;

    PageType=ListPart;

    OnInit=BEGIN

             //STEP_6-BEGIN

             Field32Visible := TRUE;

             Field31Visible := TRUE;

             Field30Visible := TRUE;

             Field29Visible := TRUE;

             Field28Visible := TRUE;

             Field27Visible := TRUE;

             Field26Visible := TRUE;

             Field25Visible := TRUE;

             Field24Visible := TRUE;

             Field23Visible := TRUE;

             Field22Visible := TRUE;

             Field21Visible := TRUE;

             Field20Visible := TRUE;

             Field19Visible := TRUE;

             Field18Visible := TRUE;

             Field17Visible := TRUE;

             Field16Visible := TRUE;

             Field15Visible := TRUE;

             Field14Visible := TRUE;

             Field13Visible := TRUE;

             Field12Visible := TRUE;

             Field11Visible := TRUE;

             Field10Visible := TRUE;

             Field9Visible := TRUE;

             Field8Visible := TRUE;

             Field7Visible := TRUE;

             Field6Visible := TRUE;

             Field5Visible := TRUE;

             Field4Visible := TRUE;

             Field3Visible := TRUE;

             Field2Visible := TRUE;

             Field1Visible := TRUE;

             //STEP_6-END

           END;

 

    OnOpenPage=BEGIN

                 //STEP_6-BEGIN

                 MATRIX_NoOfMatrixColumns := ARRAYLEN(MATRIX_CellData);

                 //STEP_6-END

               END;

 

    OnAfterGetRecord=VAR

                       MATRIX_CurrentColumnOrdinal@1018 : Integer;

                     BEGIN

                       //STEP_6-BEGIN

                       MATRIX_CurrentColumnOrdinal := 0;

                       IF MatrixRecord.FIND('-') THEN

                         REPEAT

                           MATRIX_CurrentColumnOrdinal := MATRIX_CurrentColumnOrdinal + 1;

                           MATRIX_OnAfterGetRecord(MATRIX_CurrentColumnOrdinal);

                         UNTIL (MatrixRecord.NEXT(1) = 0) OR (MATRIX_CurrentColumnOrdinal = MATRIX_NoOfMatrixColumns);

                       //STEP_6-END

                     END;

 

  }

  CONTROLS

  {

    { 1900000001;0;Container;

                ContainerType=ContentArea }

 

    { 1   ;1;Group  ;

                Name=Group;

                Description=STEP_9;

                GroupType=Repeater;

                FreezeColumnID=Name }

 

    { 2   ;2;Field  ;

                Description=STEP_1;

                SourceExpr="No." }

 

    { 4   ;2;Field  ;

                Description=STEP_1;

                SourceExpr=Name }

 

    { 1008;2;Field  ;

                Name=Field1;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[1];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[1];

                Visible=Field1Visibl e;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(1);

                            END;

                             }

 

    { 1100409033;2;Field  ;

                Name=Field2;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[2];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[2];

                Visible=Field2Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(2);

                            END;

                             }

 

    { 1100409034;2;Field  ;

                Name=Field3;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[3];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[3];

                Visible=Field3Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(3);

                            END;

                             }

 

    { 1100409031;2;Field  ;

                Name=Field4;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[4];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[4];

                Visible=Field4Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(4);

                            END;

                             }

 

    { 1100409032;2;Field  ;

                Name=Field5;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[5];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[5];

                Visible=Field5Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(5);

                            END;

                             }

 

    { 1100409029;2;Field  ;

                Name=Field6;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[6];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[6];

                Visible=Field6Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(6);

                            END;

                             }

 

    { 1100409030;2;Field  ;

                Name=Field7;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[7];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[7];

                Visible=Field7Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(7);

                            END;

                             }

 

    { 1100409027;2;Field  ;

                Name=Field8;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[8];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[8];

                Visible=Field8Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(8);

                            END;

                             }

 

    { 1100409028;2;Field  ;

                Name=Field9;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[9];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[9];

                Visible=Field9Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(9);

                            END;

                             }

 

    { 1100409025;2;Field  ;

                Name=Field10;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[10];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[10];

                Visible=Field10Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(10);

                            END;

                             }

 

    { 1100409026;2;Field  ;

                Name=Field11;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[11];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[11];

                Visible=Field11Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(11);

                            END;

                             }

 

    { 1100409023;2;Field  ;

                Name=Field12;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[12];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[12];

                Visible=Field12Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(12);

                            END;

                             }

 

    { 1100409024;2;Field  ;

                Name=Field13;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[13];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[13];

                Visible=Field13Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(13);

                            END;

                             }

 

    { 1100409021;2;Field  ;

                Name=Field14;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[14];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[14];

                Visible=Field14Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(14);

                            END;

                             }

 

    { 1100409022;2;Field  ;

                Name=Field15;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[15];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[15];

                Visible=Field15Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(15);

                            END;

                             }

 

    { 1100409019;2;Field  ;

                Name=Field16;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[16];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[16];

                Visible=Field16Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(16);

                            END;

                             }

 

    { 1100409020;2;Field  ;

                Name=Field17;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[17];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[17];

                Visible=Field17Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(17);

                            END;

                             }

 

    { 1100409017;2;Field  ;

                Name=Field18;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[18];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[18];

                Visible=Field18Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(18);

                            END;

                             }

 

    { 1100409018;2;Field  ;

                Name=Field19;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[19];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[19];

                Visible=Field19Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(19);

                            END;

                             }

 

    { 1100409015;2;Field  ;

                Name=Field20;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[20];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[20];

                Visible=Field20Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(20);

                            END;

                             }

 

    { 1100409016;2;Field  ;

                Name=Field21;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[21];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[21];

                Visible=Field21Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(21);

                            END;

                             }

 

    { 1100409013;2;Field  ;

                Name=Field22;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[22];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[22];

                Visible=Field22Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(22);

                            END;

                             }

 

    { 1100409014;2;Field  ;

                Name=Field23;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[23];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[23];

                Visible=Field23Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(23);

                            END;

                             }

 

    { 1100409011;2;Field  ;

                Name=Field24;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[24];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[24];

                Visible=Field24Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(24);

                            END;

                             }

 

    { 1100409012;2;Field  ;

                Name=Field25;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[25];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[25];

                Visible=Field25Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(25);

                            END;

                             }

 

    { 1100409009;2;Field  ;

                Name=Field26;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[26];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[26];

                Visible=Field26Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(26);

                            END;

                             }

 

    { 1100409010;2;Field  ;

                Name=Field27;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[27];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[27];

                Visible=Field27Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(27);

                            END;

                             }

 

    { 1100409007;2;Field  ;

                Name=Field28;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[28];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[28];

                Visible=Field28Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(28);

                            END;

                             }

 

    { 1100409008;2;Field  ;

                Name=Field29;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[29];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[29];

                Visible=Field29Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(29);

                            END;

                             }

 

    { 1100409005;2;Field  ;

                Name=Field30;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[30];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[30];

                Visible=Field30Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(10);

                            END;

                             }

 

    { 1100409006;2;Field  ;

                Name=Field31;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[31];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[31];

                Visible=Field31Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(31);

                            END;

                             }

 

    { 1100409004;2;Field  ;

                Name=Field32;

                BlankNumbers=BlankZero;

                Description=STEP_3|STEP_9;

                SourceExpr=MATRIX_CellData[32];

                AutoFormatType=1;

                CaptionClass='3,' + MATRIX_ColumnCaption[32];

                Visible=Field32Visible;

                OnDrillDown=BEGIN

                              MatrixOnDrillDown(32);

                            END;

                             }

 

  }

  CODE

  {

    VAR

      SalesLine@1035 : Record 37;

      MatrixRecords@1002 : ARRAY [32] OF Record 27;

      MatrixRecord@1039 : Record 27;

      MATRIX_NoOfMatrixColumns@1001 : Integer;

      MATRIX_CellData@1042 : ARRAY [32] OF Decimal;

      MATRIX_ColumnCaption@1000 : ARRAY [32] OF Text[1024];

      Field1Visible@19069335 : Boolean INDATASET;

      Field2Visible@19014807 : Boolean INDATASET;

      Field3Visible@19062679 : Boolean INDATASET;

      Field4Visible@19074839 : Boolean INDATASET;

      Field5Visible@19043543 : Boolean INDATASET;

      Field6Visible@19067287 : Boolean INDATASET;

      Field7Visible@19067863 : Boolean INDATASET;

      Field8Visible@19039959 : Boolean INDATASET;

      Field9Visible@19008663 : Boolean INDATASET;

      Field10Visible@19006501 : Boolean INDATASET;

      Field11Visible@19052468 : Boolean INDATASET;

      Field12Visible@19013039 : Boolean INDATASET;

      Field13Visible@19079726 : Boolean INDATASET;

      Field14Visible@19077225 : Boolean INDATASET;

      Field15Visible@19035896 : Boolean INDATASET;

      Field16Visible@19003763 : Boolean INDATASET;

      Field17Visible@19049730 : Boolean INDATASET;

      Field18Visible@19007213 : Boolean INDATASET;

      Field19Visible@19053180 : Boolean INDATASET;

      Field20Visible@19014629 : Boolean INDATASET;

      Field21Visible@19060596 : Boolean INDATASET;

      Field22Visible@19021167 : Boolean INDATASET;

      Field23Visible@19047854 : Boolean INDATASET;

      Field24Visible@19045353 : Boolean INDATASET;

      Field25Visible@19004024 : Boolean INDATASET;

      Field26Visible@19011891 : Boolean INDATASET;

      Field27Visible@19057858 : Boolean INDATASET;

      Field28Visible@19015341 : Boolean INDATASET;

      Field29Visible@19061308 : Boolean INDATASET;

      Field30Visible@19010597 : Boolean INDATASET;

      Field31Visible@19056564 : Boolean INDATASET;

      Field32Visible@19017135 : Boolean INDATASET;

 

    LOCAL PROCEDURE MATRIX_OnAfterGetRecord@1047(ColumnID@1000 : Integer);

    VAR

      Cust@1001 : Record 18;

    BEGIN

      //STEP_6-BEGIN

      Cust.COPY(Rec);

      Cust.SETRANGE("Type Filter","Type Filter"::Item);

      Cust.SETRANGE("No. Filter",MatrixRecords[ColumnID]."No.");

      Cust.CALCFIELDS("Total Amount");

      MATRIX_CellData[ColumnID] := Cust."Total Amount";

      SetVisible;

      //STEP_6-END

    END;

 

    PROCEDURE Load@3(MatrixColumns1@1001 : ARRAY [32] OF Text[1024];VAR MatrixRecords1@1002 : ARRAY [32] OF Record 27;VAR MatrixRecord1@1000 : Record 27);

    BEGIN

      //STEP_5-BEGIN

      COPYARRAY(MATRIX_ColumnCaption,MatrixColumns1,1);

      COPYARRAY(MatrixRecords,MatrixRecords1,1);

      MatrixRecord.COPY(MatrixRecord1);

      //STEP_5-END

    END;

 

    PROCEDURE MatrixOnDrillDown@1100409001(ColumnID@1000 : Integer);

    BEGIN

      //STEP_9-BEGIN

      SalesLine.SETCURRENTKEY("Sell-to Customer No.",Type,"No.");

      SalesLine.SETRANGE("Sell-to Customer No.","No.");

      SalesLine.SETRANGE(Type,SalesLine.Type::Item);

      SalesLine.SETRANGE("No.",MatrixRecords[ColumnID]."No.");

      FORM.RUN(0,SalesLine);

      //STEP_9-END

    END;

 

    PROCEDURE SetVisible@6();

    BEGIN

      //STEP_6-BEGIN

      Field1Visible := MATRIX_ColumnCaption[1] <> '';

      Field2Visible := MATRIX_ColumnCaption[2] <> '';

      Field3Visible := MATRIX_ColumnCaption[3] <> '';

      Field4Visible := MATRIX_ColumnCaption[4] <> '';

      Field5Visible := MATRIX_ColumnCaption[5] <> '';

      Field6Visible := MATRIX_ColumnCaption[6]<> '';

      Field7Visible := MATRIX_ColumnCaption[7] <> '';

      Field8Visible := MATRIX_ColumnCaption[8]<> '';

      Field9Visible := MATRIX_ColumnCaption[9] <> '';

      Field10Visible := MATRIX_ColumnCaption[10] <> '';

      Field11Visible := MATRIX_ColumnCaption[11] <> '';

      Field12Visible := MATRIX_ColumnCaption[12] <> '';

      Field13Visible := MATRIX_ColumnCaption[13] <> '';

      Field14Visible := MATRIX_ColumnCaption[14] <> '';

      Field15Visible := MATRIX_ColumnCaption[15] <> '';

      Field16Visible := MATRIX_ColumnCaption[16] <> '';

      Field17Visible := MATRIX_ColumnCaption[17] <> '';

      Field18Visible := MATRIX_ColumnCaption[18] <> '';

      Field19Visible := MATRIX_ColumnCaption[19] <> '';

      Field20Visible := MATRIX_ColumnCaption[20] <> '';

      Field21Visible := MATRIX_ColumnCaption[21] <> '';

      Field22Visible := MATRIX_ColumnCaption[22] <> '';

      Field23Visible := MATRIX_ColumnCaption[23] <> '';

      Field24Visible := MATRIX_ColumnCaption[24] <> '';

      Field25Visible := MATRIX_ColumnCaption[25] <> '';

      Field26Visible := MATRIX_ColumnCaption[26] <> '';

      Field27Visible := MATRIX_ColumnCaption[27] <> '';

      Field28Visible := MATRIX_ColumnCaption[28] <> '';

      Field29Visible := MATRIX_ColumnCaption[29] <> '';

      Field30Visible := MATRIX_ColumnCaption[30] <> '';

      Field31Visible := MATRIX_ColumnCaption[31] <> '';

      Field32Visible := MATRIX_ColumnCaption[32] <> '';

      //STEP_6-END

    END;

 

    BEGIN

    {

      <changelog>

        <add id="STEP_1"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 1 – One-Page Matrix Step-by-Step</add>

        <change id="STEP_3"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 3 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_5"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 5 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_6"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 6 – One-Page Matrix Step-by-Step</change>

        <change id="STEP_9"

          dev="lvanvugt"

          date="2012-04-20"

          source="http://dynamicsuser.net/blogs/vanvugt/archive/2012/04/20/how-to-create-a-one-page-matrix.aspx"

          releaseversion="Advanced Matrix Box">Step 9 – One-Page Matrix Step-by-Step</change>

      </changelog>

    }

    END.

  }

}

 

2 Comments

  1. Hi Gunnar,

    I ran into the same and noticed that the columns are still shown having columns headings showing the ID of the control. I reported this "bug" to MS and still waiting for an answer. I was in doubt whether to mention it on the blog post. I chose not to until I would have an answer.

    Regarding the reload: not that I know of. :-$

    Thanx for asking. Any other feedback? Is the "recipe"useful? I am going to update to incorporate the second example. Any hints for improvements are very welcome.

  2. Thanx, Tomi. Good to hear. 🙂

    b rg

    Luc

Leave a Reply

Your email address will not be published. Required fields are marked *