How To create a Matrix-form in Navision?
Author: Alain Krikilion (alias kriki)
Note: The forms have been created with Navision 4.0SP1 W1
1. Example: Customers/Items
The first form (Form 50000) describes how to create a matrix-box from scratch (the matrix shows the amount for the items (and which items) a customer has bought during a certain time period.
The steps are described in the Documentation-section of the form and also in this How To.
2. Example: Show/Edit 2-dimensional array
The second form (Form 50001) is an example on how a matrix box is used to show/edit a 2-dimensional array (the documentation-section contains a description where some code has been put and which properties have been changed).
3. Steps to create a matrix-form
• Function "GetData" (for now : just make an empty function with return-value : text250)
• Function "MakeLabel" (for now : just make an empty function with a return-value of the type
you want (in general : text250))
• Property : "Source Table"
- Add a MatrixBox
• Property : "MatrixSourceTable" (=Item)
• Property : "HorzGlue","VertGlue" (=Both)
• Property : "Editable" (=No)
• Property : "Name" (=matMatrix)
• Add Fields (via "Field Menu") at the left side of the MatrixBox (="No.",Name)
• Add 1 "Text Box" to the right side of the MatrixBox
- Property "SourceExpr" (=decAmount)
• Add 1 "Text Box" as the Label of this field
- Property "SourceExpr" (=MakeLabel())
• Select the label of this field => make the label larger, so 2 LINES can be shown in it
• Select this and move it to the left => more than 1 column of that field will be showed
• "OnFormat" of matrix-cell : This is to fill up the field
- Implement now Functions "MakeLabel" and "GetData"
- TextBox "TexDateFilter" : OnAfterValidate
- TextBox "TexItemFilter" : OnAfterValidate
• TRICK for not needing this filter. Put the cursor on the label of a matrix-column (so not a label of
a row-field). Hit CTRL+F7. Now you can put filters on the table that is used to define the columns.
- In case you want an editable matrix :
- Property : "Editable" (=Yes or blank it)
- "No.","Name" : Property : "Editable" (=No)
- "Text Box" DecAmount : "OnValidate" : Test if Value is correct
- "OnAfterValidate" : Write Data to Database (Use "No." (=rec."No.") and
CurrForm.matMatrix.MatrixRec."No." to know the correct records)