Simple Table

In this example we will create a table which shows some selected items in one column and information about downstream items in others. It covers basic selection and configuration of fields being displayed. The result can be exported as a document or an excel sheet.

Note on working with these example

The easiest way to experiment with Formatters is to have two windows of Matrix open, with the a Document in one and the PRINT project in the other. Set up the Document with a Data Section, go into the layout dialog and select the new formatter.
You can now preview the formatter every time you save it, making it very fast to iterate over settings.

Basic setup

  • Open the PRINT project

  • In the TABLE category create a new TABLE called “Requirements Table”

  • Open the new TABLE item and configure the following:

    • ITERATOR: Select “Children of folder”
This will determine how your selection gets turned into table rows.

    • TABLE HEADERS: Create a table in the editor with 1 row, with the titles of your columns
. Select all cells, right click, and in the menu select Cell → Cell Properties … and then change the cell type to “Header cell”

    • ITEM ROWS - CELLS: Click in the content column to add a row and select the following for now: “FORMAT -> Generics -> Item Hyperlink Matrix” and “FORMAT -> Generics -> Item Title”


  • Save the changes and press the View button in the Section Layout dialog


Linked Items

  • In the SUBTABLE Category create a new item called “SPEC Subtable”

  • Open the new SUBTABLE and configure the following

    • ITERATOR: Select “Links of item”
In this case we want to follow the links of a given item, in this case the REQ


    • ITERATOR PARAMS: Set the following parameters: {"categories":["SPEC"]}
This will only include links to SPECs


    • CELLS: Click in “content” and select “Item Hyperlink Matrix and Title”


    • Save the subtable and repeat this for Testcases, using TC as the category filter

    • Go back to the SPEC subtable and add a second column, selecting the TC SUBTABLE and setting the sub table index to column 1.
      This will follow links from SPEC to TC and use the first column of the TC table as the second column of the SPEC table

    • Save and go back to the TABLE and add both column 1 and column 2 of the SPEC subtable.

  • Save the changes and press the View button in the Section Layout dialog:


Formatting

Column Widths

Since the content in the different columns has different width requirements we will change the default width to make the space distribution look better. The table in the document is based on the header table so all we have to do is modify the width of each of the columns. This can be done by dragging the cell borders, or by editing the source HTML (View → Source Code). If you want exact control using the second approach is more exact since the visual resizing of a column tends to affect the surrounding columns as well. Here is an example HTML for the table header:

<table style="border-collapse: collapse; width: 100%; border-color: #000000; border-style: solid;" border="1">
<tbody>
<tr style="background-color: #c2e0f4;">
<th style="width: 15%; height: 29px;">Item ID</th>
<th style="width: 40%; height: 29px;">Item Title</th>
<th style="width: 15%; height: 29px;">Specification</th>
<th style="width: 15%; height: 29px;">Test Cases</th>
<th style="width: 15%; height: 29px;">Risks</th>
</tr>
</tbody>
</table>

Colors

  • Open the Administration and go Projects -> [Your Project] -> Project Settings -> Word / PDF Styling

  • Click on “Customise print styling”

  • In the dialog define basic styling for the table elements:

table {
  font-family: Helvetica;
  text-align: center;
  vertical-align: middle;
  width: 100%;
}
th {
  font-weight: bold;
  height: 50px;
  background-color: rgb(77,115,190);
  color: white;
}
td {
  padding: 10px;
  background-color: rgb(233,235,244);
}
  • Close the dialog and reload the Document Page to reload the styling. A preview should now look like this:


Adding complex content

A table can only follow a single chain of links via SUBTABLES since the table size would get too big otherwise. To list other downlinks it’s possible to embed a list of links though.

  • Create a new LIST item

  • Configure the LIST item to include the RISKs linked from the REQ

    • For ITERATOR select “Links of item”

    • For ITERATOR PARAMS set: {"categories":["RISK"]}

    • For UL set <ul>

    • For LI set <li>

    • In the ITEM field enter the ID of the “Item ID with Hyperlink + Title” formatter, followed by !, for example:
      FORMAT-1!
      When saved the result should look similar to this:

  • Save the LIST

  • Create a new FORMAT item

    • For RENDER type in the ID of the LIST you just created followed by !, for example:
      LIST-18!

  • Save the FORMAT

  • Open the TABLE item

  • Add a new column at the end of the TABLE HEADERS and type in “Risks”

  • Add a new item in ITEM ROWS - CELLS and select the FORMAT you created above

  • Save the TABLE, the preview should now look like this: