This is another article of a series of articles about M2Doc as a new technology to generate Word reports out of medini models. You can find additional extensions (beta status) for 2022 R1 and 2022 R2 in our extension area on the online support page. In the 2023 R1 release M2Doc is already included, just has to be enabled in the Preferences > Reporting. All samples posted here are for 2022 R2. Main intention is to make you aware of the new technology but also to get any kind of feedback.
This sample is about a traceability Matrix (i.e. with a variable number of columns), and because we cannot do this completely in Word, also about the Javascript services, which we introduced for M2Doc.
The usage is rather simple: The list of rows (verticalInputs) and columns (horizontalInputs) is prepared as variables (let statements), and then they are given to the traceabilityMatrix() service. Additional parameters are, which properties shall be used for the first row/column ("label" in this case). The last parameter is for coloring the rows differently. Look into the Word template for more information and documentation.
{ m:let horizontalInputs = vulnerabilities.weaknesses->sortedBy(e|e.id) }
{ m:let verticalInputs = attacks.triggers->sortedBy(e|e.id) }
{ m:verticalInputs->traceabilityMatrix(horizontalInputs, 'label', 'label', null) }
{ m:endlet horizontalInputs }
{ m:endlet verticalInputs }
The output looks like this:

The coloring could be used for checking, if a row item does not have traces to any of the columns items (can be check with an AQL statement), and then marked yellow (wasn't done in the above example).
This is all shown in the attached example project (2022R2).
Note: In case you need multiple Javascript services for M2Doc, which you don't want to combine in one file (which you could), you can also place multiple .js files in the /config/reports folder.
I hope that helps you for your reports.
Happy Reporting,
Nils