11.5. Using Map Services

You can use the mapping services key() and value() to extract keys and values, for example from a guideword analysis table.

To recreate part of a guideword analysis table as a table in a report, you can use a template as shown below. Keys, such as guideword names, and values, such as the corresponding failure descriptions, can be mapped from the guideword analysis table to the M2Doc report.

Note that this table is structured to list the guidewords and findings vertically instead of horizontally. This is because there are variable numbers of guideword results and findings results for each entry. Because we are using for loops, the table can grow vertically, but not horizontally.

ElementGuidewordFindings

{ m:for e | analysis.entries }

{ m:e.element.name }  

{ m:for f | e.guidewordToFailures }

 { m:f.key().name } 

{ m:for mf | f.value() }

  { m:mf.name }

{ m:endfor }

{ m:endfor }

{ m:endfor }

The resulting table is shown below.

Table 11.2: Resulting M2Doc Table

ElementGuidewordFindings
Main Function  
 NO OR NOT 
  No main
 LESS 
  Not enough main
Secondary Function  
 MORE 
  Too much secondary
 NO OR NOT 
  No secondary
 LESS 
  Not enough secondary
Diagnose Function