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. An official release is planned for 2023 R1. 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 tables, together with loops used for them to access the individual elements (table rows) of a list from medini. The loop used for the rows is as simple as shown below:
here is header row in the Word template
{ m:for e | ftaModel.events }
here is the contents row in the Word template, in which you can access events data with { m:e.id } or { m:e.name }
{ m:endfor}
Filtering is possible with something like this around the contents cell (still within the for loop):
{ m:if e.probabilityData.cycle + '' = 'MONITORED' }
{ m:endif }
Note: Some medini models only directly give you a list of top level elements, e.g. myRequirementsModel.requirements lists only the top level requirements. If you have sub-requirements and want all to be displayed, use myRequirementsModel.eAllContents(safetygoals::SafetyRequirement) to get all requirements within that model.
Additional note: If the tables should have a list of strings within a cell, you can use the ->sep() operation of AQL. When used on a list, it inserts the separator in between the list items. Example (just lists the requirement names separated with commas):
{ m:myRequirementsModel.requirements.name->sep(', ') }
Alternatively, you can use ->sep('\n') to start a new line after each entry.
This is all shown in the attached example project (2022R2).
Happy Reporting,
Nils