projectdoc Toolbox

Lists references to projectdoc documents in a table. Allows to select document properties for columns. Also non-list representations are provided.

Audience
Categories
Display / Query
Tags
Type
Supports Wiki Markup
(tick)

With the Display Table Macro document authors display result sets of document queries.This allows to add references to documents on the the wiki that automatically expands when new documents are added that match the given search criteria.

The macro allows to select properties and section from the documents. The search result is filtered by a where clause in Lucene syntax. The macro also allows to sort the result set by properties.

Accessing a single Property

 

If you only need to access a single property value within text, have a look at the Display Document Property Macro.

Since 2.5

 

Wiki Markup is supported since version 2.5.

Properties

Doctype(s)

Specify the type of the documents to select. If documents from more than one document type are to be selected, enumerate them in a comma-separated list. Leave blank to select documents from any doctypes.

If a property selected from a document is not supported by a doctype, a blank cell will be rendered.

Select

Specify a comma-separated list of document properties or section names to display.

If not specified, the name and short description of the document is displayed per default.

If no link should be generated, add '-' at the end of the property name. For properties to show a link, add a '+' at the end of the name.

The property name may be the name of a section of the document to be transcluded.

Since 2.3

 

Use Templates to render complex values in a column cell. The syntax to specify a template is

#COLUMN_NAME{TEMPLATE_SPECIFICATION}

The column name is the label to use for the column heading. It may be replaced using Display Table Macro#Header Translations.

The template specification uses placeholders to reference properties.

Example Template Specification

 
#My Label{${Doctype} / ${Iteration}}

The template will access the Doctype and Iteration property to render the specified string for each row in the given column.

Where

A Lucene search expression to filter on the results. If the property contains spaces, remove them or use $[...].

Examples:

  • Name = "foo" AND ShortDescription NOT \"bar\"
  • Name = "foo" AND $[Short Description] NOT \"bar\"

Please refer to Search Tips for information on limitations and extensions on the search expression syntax provided by projectdoc.

Curly Braces

 

Curly braces may cause problems on some instances of Confluence when used in a string parameter field of a macro. This is especially true (and reproducible) if you use an opening and an immediate closing bracket like this: "{}".

This is a known issue (CONFSERVER-33399) and is also discussed in Do curly braces in string macro parameters break the macro?.

To work around this problem you may escape the curly braces with a backslash as in

$[Story Points] = $\{Magic Value\}

You need to use this workaround if you cannot save the page (as described in the issue above). Otherwise it is just a failed rendering of the macro in the macro editor.

Sort By

The comma-separated list of document property names to use for sorting.

Sort Order

Add a '+' (default) for ascending, a '-' for descending order.

Sort Directives

Since 2.0

 

Since version 2.0 the sort by allows directives to control the sort order.

The directive selects the sort order breadth first (display direct children, then children at level two, the three, and so on) or depth first (run from the root node to the first leaf, second leaf, and so on until no leaf is left, then proceed with the parents sibling and so on). The sorter takes the position of the child (as specified via the space content tool to reorder pages) into account. This may be called the natural sort order since it is the sort order imposed by Confluence and it does not depend on any document property.

Note that all documents in the result set must have a common ancestor.

Directives cannot be used together with other sort constraints. A directive starts with a hashmark (#).

DirectiveDescriptionSyntax
Breadth First

A breadth first sort of a page tree.

#BREADTH_FIRST
Depth First

A depth first sort of a page tree.

#DEPTH_FIRST

There are three different implementations to choose from. Per default the Memory Implementation is used, which should be fine for almost all use cases.

ImplementationDescriptionSyntax
No MemoryThe sorter does not use additional memory to speed up sorting.#BREADTH_FIRST:no-mem
#DEPTH_FIRST:no-mem
Memory

The sorter uses additional memory to store intermediate results for reuse. This speeds up the sorting process for larger result sets.

This is the default implementation.

#BREADTH_FIRST:mem
#DEPTH_FIRST:mem
#BREADTH_FIRST

#DEPTH_FIRST

MaterializeThe sorter materializes the complete subtree and stores it for all lookups. This is typically the fastest sorter, but requires to know the root node in advance (root page ID).#BREADTH_FIRST:mat:{root page ID}
#DEPTH_FIRST:mat:{root page ID}

Artificial Properties

The projectdoc Toolbox provides a number of artificial properties, some of which may be helpful for sorting.

Property NameExample Value
Creation Date§20151008
Creation Timestamp0000001444337808000
Last Modification Date§20170429
Last Modification Date Timestamp0000001493416800000

Type Conversion

Add a type descriptor of the form

@{type/pattern}

The type is mandatory if the additional type descriptor is given. Valid values are

  • date
  • number

The pattern is optional to define a parsing pattern for the specified type.

Per default the sort key then the name of the document is used.

The last modification date is the last arbiter if all other properties are equal.

 

Here are some examples

Sort ByThe sort order is defined by the ...
Name-... alphanumerical order of names, descending.
Calendar Week@{number}... numerical order of the calender week, ascending.
Date of Birth-@{date}... date of birth, descending.
Date of Birth@{date/dd.MM.yyyy}... date of birth, using the defined date pattern.

Max Hit Count

The maximum number of hits requested.

Restrict to immediate Children

If checked, only immediate children of the current document are valid as hits.

Counter Column

If checked adds a counter as the first column.

Since version 1.11 table cells are tagged with a CSS class named 'projectdoc-counter-column'.

Header Translations

Comma-separated list of key value pairs. Key is the header to be replaced by the value. Format: k1=v1, k2=v2.

Calculation Columns

List column names to apply for calculation. The column names are separated by comas.

 

Since version 1.7.0.

Per default the values are treated as integers. You may select the number type by the following selectors:

SelectorDescription
iInteger value (Long Precision)
fFloat value (Double Precision)

Separate the selector with a colon from the column name (e.g. Value:f).

If you require to specify the number format, add it after an equal sign (e.g. Value:f=#0.00).

Use the following symbols to define the pattern:

SymbolDescription
.Decimal Separator
0Digit
#Optional Digit
,Grouping Separator

¤

Currency Sign
%Multiply by 100 and show as percentage
Multiply by 1000 and show as per mille value
'Quote strings (to escape symbols)
 

Here are two examples for Locale US.

If the content is 2342.738, the pattern give these results:

PatternResult
<Default>2342.738
0.002342.74
###,##0.002,342.74
¤ ##,##0.00
$ 2,342.74

Assume the following value for the next example: 0.7832

PatternResult
<Default>0.7832
%%78
%0.00%78.32
‰783

The sum is rendered in additional row. The td element is rendered with the CSS selector projectdoc-calculated-value.

Exclude Self

If checked excludes this document from the query result.

Space Key

To limit the search on documents to the space with the given key.

The editor allows to scan for space names. If you want to select more than one space, use the space keys text field (in addition to this field).

Space Keys

To limit the search on documents to the spaces with the given keys. Use this if you want to search in several spaces.

Leave blank, if you want to search in the current space only. Use "@all" to search in all spaces.

Refer to search-space for more information on selecting spaces by their Confluence Space Category (specified via the space admin page).

Render no hits as blank

If the query found no hits, the result is rendered as a short text message. If a result with no hits should not be rendered at all, check this box.

Render Mode

Controls how the table should render properties of the document result set.

There are three render modes: table, list, and section.

Table Render Mode

If you want to render the result in a table, leave this parameter value blank.

You may also explicitly set this value to table.

Add a CSS class by separating it with a "=".

Since version 1.5.0 setting the widths of the columns is supported. Added a columns descriptor in brackets after the CSS class name. The comma-separated list of width is passed as CSS style values for the width attribute.

 
  • =mystyle
  • table=mystyle
  • table=mystyle[columns=20px,120px,80px]

These CSS classes are provided by projectdoc to style your tables:

Name Short Description
Use the CSS class projectdoc-alternating for a HTML table to get alternating colored table rows.
Marks column cells that contain a row counter.
Use the CSS class projectdoc-fullwidth for a HTML table to get a table using 100% of the available width.
Use the CSS class projectdoc-halfwidth for a HTML table to get a table using 50% of the available width.
Use the CSS classprojectdoc-quarterwidth for a HTML table to get a table using 25% of the available width.
Use the CSS class projectdoc-thirdwidth for a HTML table to get a table using 33% of the available width.

List Render Mode

You may render a two column result in a list. Usually this is the case for the document name and short description.

The following values are valid:

  • definition - for a definition list
  • numbered - for a numbered list
  • unnumbered - for an unnumbered list
  • plain - for a comma separated list as plain text

You may add a CSS class by separating it with a "=".

If you add a "-" at the end, the first character of the second column value (e.g. the short description) will be lower cased.

Note that there is specialized macro for rendering lists with an easier interface: Display List Macro.

The render mode parameter allows to switch between tables and lists quickly, if you started with a table, but later decide to use a more compact format for your two-column result.

Here are a few examples with valid values:

ValueDescription
definitionRenders as a definition list.
unnumbered-Renders as an unnumbered list. The first character of the second column value is lower-cased.
definition=simpleindent-Renders a definition list with class simpleindent. The first character of the second column value is lower-cased.

Section Render Mode

To render the result with vertical tables in sections, the parameter value has to be an integer between 0 to 6, optionally be followed by a "+".

Otherwise there is a separate table for each document, where the first column contains the name of the property, the second its value. If the digit is zero, there will be no heading generated in front of the table. The first property in the select clause provides the value for this heading.

If a "+" sign is added (e.g. "2+"), the first property will be rendered in the heading and in the first row of the table. You may use this option to render the name as the heading and as a link in the first row of the table.

Since version 1.17 the properties table above the sections may be rendered as definition list (append an 'l'). Also the widths of the table may be controlled. For both representations a CSS class may be applied.

 
  • 1l
  • 1+l
  • 1l=mystyle[columns=120px,250px]

Styles for definition lists provided by the projectdoc Toolbox are documented in Definition List Macro.

Hide Empty Row

If checked, rows in two-column tables will be hidden, if the value is blank.

Remove Template Buttons

If checked template buttons are not transcluded.

Render Reference Box

If checked, a box that marks the transcluded text is rendered with a link to the part in the document (if the transcluded part is uniquely identifiable).

Since version 1.11. Prior to that version the box can only be suppressed with the space property render-transclusion-box.

Caption

The label for the table caption.

No Table Heading

If checked no heading will be rendered.

Since version 1.17 this parameter also applies for the table above the sections in Display Table Macro#Section Render Mode.

No Table

 

The parameter has been removed with version 1.5.0.

Use the Transclude Documents Macro instead.

If checked, the values will be rendered as paragraphs instead of table row. Applies only to two-column tables and only makes sense if there is only one row.

Suppress Headings

 

The parameter has been removed with version 1.5.0, since the no-table mode has been removed in favour for the Transclude Documents Macro.

If checked, headings will not be rendered in no-table mode.

Details

Remote Controlled Documents

 

Remote Controlled Documents are available since version 2.0 of the projectdoc Toolbox.

Remote Controlled Documents allow to control the content at request time. A HTTP request may override parameters of the macro. A request parameter addresses a macro by its identifier. After the identifier the name of the parameter is appended, separated by a colon.

Override Parameters

 

Assume that the identifier of the macro is set to 'my', the following call will override the doctype parameter on the page 'MyPage' in space 'MYS'.

confluence/display/MYS/MyPage?my:doctype=code

The list of parameters allowed to override:

  • doctype
  • select
  • where
  • sort-by
  • max-hit-count
  • restrict-to-immediate-children
  • render-counter-column
  • header-translations
  • calc-columns
  • exclude-self
  • space-key
  • space-keys
  • render-no-hits-as-blank
  • render-mode
  • render-heading-as-link
  • hide-empty-row
  • remove-buttons
  • render-reference-box
  • table-caption
  • suppress-table-heading
 

Since version 2.4 of the projectdoc Toolbox the Wiki Link Macro allows to specify parameters to call a Remote Controlled Document.


Template Authors

Template authors may wish to reference the value of a property of the document the query is part of. Use ${...} to reference the value of a property.

  • Type = ${Name} - the type property of the documents queried is matched with the value of the name property of the document the query is part of.

Related macros

Display List Macro
Lists references to projectdoc documents in a list. List contain names and optional short descriptions.
Display List Template Macro
Lists references to projectdoc documents in a list. List items are defined by templates referencing properties.
Index Card Macro
Renders transcluded content fetched from documents of a result set.
Index Entries Table Macro
Renders a table of index entries.
Tour-by-Property Macro
Renders a predefined list of documents in a table . Documents are selected by a document property. Allows to select document properties for columns. Also non-list representations are provided.
Transclude Documents Macro
Renders transcluded content fetched from documents of a result set.