This site has moved to the integrated Appfire documentation and information site for our apps.

From February 2024 this site is no longer updated.

Take a look here! If you have any questions please email support@appfire.com

metadata-calculate macro

Overview

The metadata-calculate macro performs calculations using metadata values from matching pages.

The macro returns a single value by totalling up any float or integer metadata. This result can be shown directly or can be used as input to another statistics macro, such as the Confluence chart macro.

This macro is most useful when presenting several totals in a single chart.

Parameters

Parameter

Required

Default

Notes

Version

Parameter

Required

Default

Notes

Version

value-name (first named parameter)



The list of fields (columns) to be included in the report. This can include added metadata and internal metadata.



function



sum

Specifies the function to apply to the matching data:

  • sum - returns the sum of each non-empty value (default)

  • average - returns the average of each non-empty value

  • maximum - returns the minimum of each non-empty value

  • minimum - returns the maximum of each non-empty value



key



current space

Limits the content returned to be within the space with the given key.



root



current page (@self)

Use @self for the current page (the default), @parent for the parent page, or the name of any page, e.g MySpace:MyPage.

If this is specified and the pages option is not, then the report will run over only the pages listed here.



label





Limits the content returned to be with specified label or labels.

A comma separated list produces ANY pages that match at least one of the listed labels. Using + operator for the list will return pages that match ALL the labels.

Parentheses can be used to build complex expressions

  • for example |label=policy, procedure)+hres| would return content with  hres and also has at least one of policy or procedure.



type





Specifies which Confluence content types should be considered for a report.

This feature was based on the Confluence contentbylabel macro which has the same attribute.



Usage

To retrieve the values for metadata from matching pages and apply a chosen calculation, choose the Metadata calculate macro from the Confluence macro browser:

The macro requires the addition metadata value name for the calculation.

The default calculation is the sum of the values of the metadata value name.

Using the macro editor, the content can be limited by the choice of

  • content labels

  • space key

  • content type

The root page for the macro is by default the current page.

The macro placeholder will display the added metadata value name.

For example, the following added metadata-calculate macro

Will display the numeric return for the chosen calculation for the selected metadata, Installs.

Example

Pages can be filtered by label so the named returned macro value will be calculated using the named metadata values from the label filtered pages.

This would display on the page with the added macro the Total (Sum) for the metadata MyValue using the values of the MyValue metadata from each page with the mylabel label.

One of the macros using different filters can be added to the Confluence chart macro.

This is displays the retrieved metadata values:

Reference Markup

{metadata-calculate:Installs|key=CAI|root=InstallsSummary|label=jira_app|}

In the example, the calculate app would summarise the (default)sum of the value of the metadata Installs.

  • the summed value returned would be from the space with the key CAI.

  • the InstallsSummary page would be the root page for the report - the values being returned from child pages with the jira_app label.

Related Comala Metadata App macros

Related documentation