Matrix Tables

EasyCatalog provides the ability to a create a matrix table — a table that expands both horizontally and vertically, populating data at the intersection of each column and row.

Matrix tables are defined using commands in an XML format, specified using the Script Label panel with the table selected.

There are three required nodes in the XML structure:

  • <matrixtable> – this defines table-specified attributes such as the width of the table, how many columns should be fixed (header columns) at the left and right of the table, etc.
  • <row> – defines the field that will be used to generate new rows in the table. A new row will be created in the document table per unique value specified by this node.
  • <column> – defines the field that will be used to generate new columns in the table. A new column will be created in the document table per unique value specified by this node.

e.g.

The behaviour of each of these nodes can be customised by adding additional attributes or sub-nodes:

<matrixtable> attributes

tablewidth
The width of the final populated table can be controlled using this attribute. Specify an absolute measurement, including measurement system, or a percentage. Percentage values will be based on the width of the table’s containing text frame (e.g. 75% will be 75% of the width of the text frame containing the table). All columns widths will be adjusted to ensure that the table fits within the measurement provided, unless ‘headercolumnsfixedwidth’ (below) is specified.
removeouterstroke
The left and right table strokes will be removed if this attribute is set to ‘true’.
groupname
If specified, this attribute will restrict EasyCatalog to only using data from a group with the specified name. For example, if the table is being populated with data from a ‘product’ group, which has a sub group for ‘specifications’ and another for ‘prices’, this attribute can be used to only use data from the ‘specifications’ sub group.
headercolumns
Specifies the number of columns on the left of the table that are fixed — these are typically header columns.
headercolumnsonright
Specifies the number of columns on the right of the table that are fixed — again, these can be header columns but are located at the right of the table.
headercolumnsfixedwidth
When set to ‘true’, only the data columns (not the header columns) are resized to ensure the table fits to the width specified by the ‘tablewidth’ attribute.
emptycellstyle
If a cell in the finished table is empty, the table cell style specified here is applied to the cell
emptycellcontent
If a cell in the finished table is empty, the cell is populated with the content specified by this attribute.

<rows> node attributes

field
One row will be created the document table for each unique value contained in the specified field.

<columns> node attributes

field
One column will be created the document table for each unique value contained in the specified field.

<group> node

By default, EasyCatalog will create one row or column per unique value in the specified fields on the <rows> and <columns> node. However, by adding the <group> node EasyCatalog will create a new row and column per unique value in the specified group.

In the above example, one column will be created per unique ‘colour’ per ‘finish’.

field
A field to group the data by – one row or column per unique value in each group will be created in the table.
sortdirection
This should be set to ‘ascending’ or ‘descending’ to specify the sort direction of the groups. This attribute is optional: if omitted an ascending sort will be used. Please ensure that the type of the field you’re sorting by is set correctly (i.e. numeric if the field contains numbers) to ensure that the correct sort order is produced.

<range> node

The <range> node can be added to the <rows> and <column> node to restrict EasyCatalog to only populating the specified number of rows or columns. This is useful in situations where, for example, the resulting table could expand outside of the bounds of the page.

For example, in your Product Style you could include two tables with different <range> nodes: the first table could be set to…

… and the second table set to:

The first table would output columns for the first 10 records being used to populate the table; the second table would contain the next 10.

<filter> node

A single <filter> node can be added to the <row> and <column> nodes to exclude records from the table. This node will only include records in the table when the specified field matches the specified value.

field
The field to filter by
value
The value to look for in the specified field. Only records matching the value specified here will be included in the document table.