projectdoc Toolbox

Applies a simple set operation on tables in its body.

Categories
Since
2.1

The Table Set Macro applies a selected set operation on tables within the macro's body. Each table is considered a set of elements. Elements are identified by the contents of the selected column.

 

The current version of the macro only processes tables where the heading is found in the first table row (either inside an HTML thead element or not).

Properties

Selected Column

Specify the column that identifies a table row.

Set Operation

Select the operation on the sets, provided by tables within the macro body.

andSelect only on rows that are part of all tables.
orSelect rows that are part of any table. Table row columns are merged for cells are blank.
notRemove rows from the first table that appear on any other table.
strict-and

Select only on rows that are part of all tables and the number of tables must be greater than one. Otherwise the result is empty.

Since 6.2.0

 

The operation strict-and is available since version 6.2.0

Column Names

Specify the names of the columns to merge in any order.

Append a character to control the alignment of the column (header and data).

SignDescription
<Left alignment
|Center alignment
>Right alignment

If no controls are specified, the styles of the first table are applied to the result column.

Header Translations

Comma-separated list of key list-value pairs to map columns from tables.

Format: k1=v1|v2, k2=v3.

To translate the headings of the tables to be merged, specify the desired column name with the Column Names. Then map these names to the columns of the merged tables.

 

For this example we assume a table merge based on and.

The columns of table one are Short Name and My Tags, of table two Short Name and OtherThe merged table should have the columns Name and Tags .

Table One
Short NameMy Tags
......
Table Two
Short NameOther
......
Merged Table
NameTags
......

This is the configuration:

Column Names
Name, Tags
Header Translations
Tags=My Tags|Other, Name=Short Name

Note that mappings a separated by a comma, alternative values from the table columns are separated by pipes.

No Content Text

The alternative text to be rendered in case the result table set is empty.

If no alternative text is specified, nothing will be rendered in case the result set is empty.

Since 7.2

 

This parameter is available since version 7.2.

CSS Class

Style information for the table

Macro Body

Expected are two or more tables.

Details

Page Size Warnings

This macro supports macros that render a table. If such a macro runs into the limits set by the page size configuration and renders a warning, then this macro will render an error.

Merging Table Columns into Rows

The Table Set Macro allows to merge the columns of tables to merge into one row in the result table. In this case you need to use the Set Operator 'or'. You need to make sure that all columns of the resulting table are present in the first table.

This allows you to for instance generate a table by the use of the Display Table Macro and add additional information by a plain HTML table. 

 

Suppose there is a couple of documents that describe books. For this example each book has a name (title) and the information about the author.

You need to list all books and you want to add the information,  if you have read the book or if you  are reading it.

The Table Set Macro does the merging of table rows. You need to select by the column 'Name' and the set operator 'or'.

The Display Table Macro lists all books.

Note that you select (Select: Name, Author|, Status|) the Status although this is not a property in the documents you are selecting. So this column will always be empty.

The information for the Status column is then added by your second table.

The name column makes the match to merge the columns of the second table into the row of the first table. The Select of the first table defines the order of representation of columns and properties.

The resulting table:

With this use case you may add information to a document listing that is not present in the documents. The difference to adding this information to the document is that you cannot select on it and cannot reuse this information in other queries. But it allows to add information that is only relevant in one specific use case.

Related Macros

Table Merger Macro
Merges tables (and lists) into one table (or list).