Creating Matrix with two cells in one column?

TiwazTiwaz Member Posts: 98
Hello experts.
I need to create a matrix page as in the picture.
As you can see, I practically need two cells under one date column header (For example, for the 1st day, it's "P" and "K").
Can this be done? I am not very experienced in making matrices.
I used MatrixManagement.GeneratePeriodMatrixData function.
I tried to create Matrix_ColumnCaption rray with dimension 31, and Matrix_CellData array with dimension 62, but I think tis is not a good way to do this?
Thank you in advance!
wcoz56gp5xj1.png

Answers

  • AlexDenAlexDen Member Posts: 86
    Hi,

    I think that it's impossible to do this via repeater control.

    But if you just need to display information then you can use WebPageViewer control.
    Below you can find an example how to do this:
    OBJECT Page 50255 HTML Matrix
    {
      OBJECT-PROPERTIES
      {
        Date=22.07.19;
        Time=16:00:00;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        OnOpenPage=VAR
                     I@1000000000 : Integer;
                     J@1000000001 : Integer;
                   BEGIN
                     HTMLText := '<TABLE cellspacing="0" border="1" bordercolor="#DDDEEE" cellpadding="2" style="font-family:Verdana,Arial;font-size:8pt;border-collapse: collapse;">';
    
    
                     // Generate header
                     FOR I := 1 TO 2 DO BEGIN
                       HTMLText += '<TR><TD></TD>';
                       FOR J := 1 TO 31 DO BEGIN
                         IF I = 1 THEN
                           HTMLText += STRSUBSTNO('<TH colspan=2>%1</TH>', J) // Merge 2 cells in the first row
                         ELSE
                           HTMLText += '<TH>VM</TH><TH>NM</TH>';
                       END;
                       HTMLText += '</TR>';
                     END;
    
                     // Generate lines
                     FOR I := 1 TO 5 DO BEGIN
                       HTMLText += STRSUBSTNO('<TR><TD>Line %1</TD>', I);
                       FOR J := 1 TO 31 DO
                         HTMLText += '<TD>P1</TD><TD>K2</TD>';
                       HTMLText += '</TR>';
                     END;
    
                     HTMLText += '</TABLE>';
                   END;
    
      }
      CONTROLS
      {
        { 1000000000;;Container;
                    ContainerType=ContentArea }
    
        { 1000000002;1;Field  ;
                    CaptionML=ENU=Field Caption;
                    SourceExpr='Text field' }
    
        { 1000000001;1;Field  ;
                    Name=WebPageViewer;
                    ControlAddIn=[Microsoft.Dynamics.Nav.Client.WebPageViewer;PublicKeyToken=31bf3856ad364e35] }
    
      }
      CODE
      {
        VAR
          HTMLText@1000000000 : Text;
    
        EVENT WebPageViewer@-1000000001::ControlAddInReady@8(callbackUrl@1000000000 : Text);
        BEGIN
          CurrPage.WebPageViewer.SetContent(HTMLText);
        END;
    
        EVENT WebPageViewer@-1000000001::DocumentReady@9();
        BEGIN
        END;
    
        EVENT WebPageViewer@-1000000001::Callback@10(data@1000000000 : Text);
        BEGIN
        END;
    
        EVENT WebPageViewer@-1000000001::Refresh@11(callbackUrl@1000000000 : Text);
        BEGIN
          CurrPage.WebPageViewer.SetContent(HTMLText);
        END;
    
        BEGIN
        END.
      }
    }
    
    
    
Sign In or Register to comment.