Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt
hiddentrue

Increment a metadata value to support custom versions (available from v6.11+)

The {increment-metadata} macro increments a numeric metadata value. 

...

Where to use it?

One or more {increment-metadata} macros can be put in a {trigger} macro.

The metadata value must have been already set e.g. at page creation using the {set-metadata} macro macro.

Parameters

ParameterRequiredDefaultNotes
metadata name(tick)none

The metadata item.

The metadata item value is numeric and can be:

  •  simple (e.g. whole number)
  • composite (eg 2.1 or 2.1.1)

A non-numerical character can be used to separate "-" the metadata numeric values e.g. 1__2-4. The separator can be any non-numeric character.

A suffix may be used after the last numeric element e.g. 2.1.1-BETA. This can be any set of characters (including letters, symbols, and numbers).

increment
increment last numeric element by 1

The increment expression, if specified, is a numeric expression to increment element(s) of the numeric value.

If no increment value is specified the last numeric element of the current metadata value is incremented by 1.

The expression can be:

  • a simple integer number (e.g. 2)
  • composite number (e.g. 1.2  or 1.2.3)

A composite number cannot be more than 3 numeric elements e.g. 1.2.3.4 is not supported.

When defining the increment expression the format MUST match the metadata item value format including any separators and suffix identifiers.

  • increment or a change for non-numeric elements is not supported.
  • incrementing a single higher-order element of a composite numeric value will reset any lower-order elements to zero e.g. a metadata value of 1.2.3 with an increment expression of 1.0.0 will update the value to 2.0.0.

...

The increment expression format including any separator characters and the suffix identifier MUST match the metadata item value being incremented. 


Metadata ValueIncrement ExpressionResulting Value
1<empty>2
1.0<empty>1.1
1.00.11.1
1.01.02.0
3.5.1<empty>3.5.2
3.5.10.0.13.5.2
3.5.10.2.03.7.0
3.5.10.2.13.7.2
3.5.11.0.04.0.0
3.5.11.1.14.6.2
3.5.1-Beta1.0.0-Beta4.0.0-Beta

...

The example shown uses the increment increment-metadata macro to support the custom versioning of a page using a simple numeric metadata value.

The metadata name and initial value are set on the creation of the page using a trigger macro and the set-metadata action macro.

{set-metadata:my-version}0{set-metadata}

...

  • on a state change to the Approved state.

Note that the (green star) The metadata is associated with the page. At any one point in time, the metadata value is will be the same in any workflow state.For

  • for example, a user viewing previously published content in the workflow final state whilst content in the draft state

...

The Confluence version may however be different if the page has been updated or edited in one of the workflow states.

In the simple increment example, this can be seen if you use a one get-metadata macro to display the metadata my-version and a second  get-metadata macro  macro to display the Confluence version on a page.


Add the page-activity macro to the page to see the workflow activity

...