Thursday, August 23, 2018

NAV - Matrix Page Notes - Items by Location


  • Matrix Page Example P9231 Items by Location Matrix
    • PageType: Listpart
    • Page Source: Table of values on the left  (Items) 
    • Create an Array for 30 dimensions, and a column for each value in your array
    • OnAfterGetRecord
      • Create a counter that will increment based on headers for each column from values (Locations)
      • Filter and sum your ItemLedgerEntry data by Current Item and Current Location, store that value in your array[Location col no] and create a repeat loop to populate each value for each cell based on the current record value, and the current column counter value
-------------------------------------------------Example---------------------------------------
OnAfterGetRecord()
MATRIX_CurrentColumnOrdinal := 0;
IF TempMatrixLocation.FINDSET THEN
  REPEAT
    MATRIX_CurrentColumnOrdinal := MATRIX_CurrentColumnOrdinal + 1;
    MATRIX_OnAfterGetRecord(MATRIX_CurrentColumnOrdinal);
  UNTIL (TempMatrixLocation.NEXT = 0) OR (MATRIX_CurrentColumnOrdinal = MATRIX_NoOfMatrixColumns);

LOCAL MATRIX_OnAfterGetRecord(ColumnID : Integer)
TempItem.COPY(Rec);
TempItem.SETRANGE("Location Filter",MatrixRecords[ColumnID].Code);
TempItem.CALCFIELDS(Inventory);
MATRIX_CellData[ColumnID] := TempItem.Inventory;
SetVisible;

No comments:

Post a Comment