- Created by Robert Reiner, last modified on 25. Apr 2023
projectdoc Toolbox
The macro allows to merge tables from different sources into one table.
Example sources may be the Transclusion Macro transcluding a table or the Display Table Macro.
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).
The Table Merger Macro does only merge rows of two tables and allows a row mapping. In case cells of two tables should be merged into one row, use the Table Set Macro. For details on this use case, refer to Merging Table Columns into Rows
Properties
Column Names
List of column names to render.
If blank the columns from the tables are used.
Discard
Allows to discard list items or rows.
empty | Discard empty list items or table rows without cell content. |
---|---|
no-links | Discard list items or table rows if there is not at least one link. |
no-items | Discard list items or table rows if link has class projectdoc-no-docs. |
full | Discard list items or table rows if fully set (all cells have content). |
partial | Discard table rows if there is at least one empty cell. |
is-checked | Discard list items or table rows if a task list with at least one checked checkbox is found. |
is-not-checked | Discard list items or table rows if a task list with at least one checkbox is found that is not checked. |
strikethrough | Discard list items or table rows if at least some text is tagged with strikethrough. |
The values empty
, no-links
, no-items
, and no-links + no-items
are typically used for definition, numbered, and bullet lists.
The values empty
, full
, and partial
are typically used for tables. The value partial
only has meaning for tables.
The value can be controlled by the space property Table Merger Macro Param Discard. The space property Table Merger override empty Items overrides the macro configuration.
New Values
The values full
and partial
are supported since version 4.5.
The values is-checked
and is-not-checked
are supported since version 4.6.
Since 5.0
The value strikethrough
is available since version 5.0.4.
Header Translations
Comma-separated list of key list-value pairs to map columns from tables. This allows to rename columns to match.
Format: k1=v1|v2, k2=v3
.
In case the column header should be renamed, simply specify the new column name with the Column Names parameter and map the columns of the merged tables here.
If the column on both tables to be merged is "A" but it should be named "X" and the second column "Short Description" should be not renamed, then:
- Column Names:
X, Short Description
- Header Translations:
X=A
In case the column to be named "X" is merged from columns named "A" and "B" then:
- Column Names:
X, Short Description
- Header Translations:
X=A|B
Sort By
Specify the column names for a sort order. The suffix "-" will invert the sort order (descending).
Table Sort Orders
- Name-
- Bonus Points, Name
Any string will turn on sort on list items.
Until 6.0.3
Up to version 6.0.3 the sort column for tables is limited to one column and the order is always ascending.
Note that sorting is executed on table rows. If the rows reference documents, the properties used for sorting must be rendered in the tables.
CSS Class
Set to the table or definition list.
Macro Body
Tables or lists (dl
, ul
, ol
) found in the body of the macro are merged.
Only tables or lists of the same kind are merged. If a collection of one kind is found, collection of other types are not merged. For instance you cannot merge tables with definition lists. If at least one table is found, lists of any kind are not merged.
Details
Some details on using this macro.
Nested Lists
Since lists may be nested, it is important to only use list roots when merging lists. Therefore lists are required to be siblings to be merged successfully. If lists are nested within other containers, the root containers can be marked with projectdoc-table-merger-root
to select the contained list.
This is especially useful when the Content Marker Macro is used to make parts of lists only available for users with specified permissions or being members of specified groups.
Since 4.9
This feature is available since version 4.9.
Merging Text Lists
Text lists rendered with the Display Document Property As List Macro may be merged by this macro.
Since 4.11
This feature is available since version 4.11 of the projectdoc Toolbox.
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.
Related Macros
- Table Set Macro
- Applies a simple set operation on tables in its body.
- Display Table Macro
- Lists references to projectdoc documents in a table. Allows to select document properties for columns. Also non-list representations are provided.
Ressources
Related information.
- Merging Tables and Lists
- References listed in tables and lists may come from different sources. The Table Merger Macro allows to render a number of tables (or lists) as one table (or list).
- Filter on Table Rows
- The projectdoc Toolbox for Confluence provides a macro to merge tables. The macro also allows to filter on table rows. This tip provides a short overview.
- Table Merger Macro Param Discard
- Allows to discard list items.
- projectdoc-no-docs
- Tags links that refer to a home page without having an index page attached. This is a quick check if at least one document has been created since this launches the creation of the index page for this document type.
- Wiki Link Macro
- Allows to render a link to a wiki page.
- Table Merger override empty Items
- Allows to override the hide empty lines configuration of the Table Merger Macro.