...
Excerpt | ||
---|---|---|
| ||
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.
...
Parameter | Required | Default | Notes |
---|---|---|---|
metadata name | none | The metadata item. The metadata item value is numeric and can be:
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 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.
|
...
Metadata Value | Increment Expression | Resulting Value |
---|---|---|
1 | <empty> | 2 |
1.0 | <empty> | 1.1 |
1.0 | 0.1 | 1.1 |
1.0 | 1.0 | 2.0 |
3.5.1 | <empty> | 3.5.2 |
3.5.1 | 0.0.1 | 3.5.2 |
3.5.1 | 0.2.0 | 3.7.0 |
3.5.1 | 0.2.1 | 3.7.2 |
3.5.1 | 1.0.0 | 4.0.0 |
3.5.1 | 1.1.1 | 4.6.2 |
3.5.1-Beta | 1.0.0-Beta | 4.0.0-Beta |
An <empty>
increment expression simply includes the name of the metadata value to increment.
...
Code Block | ||||
---|---|---|---|---|
| ||||
{workflow:name=Simple Increment Metadata} {state:Draft|submit=Review} {state} {state:Review|approved=Approved} {approval:Review|assignable=true} {state} {state:Approved|final=true|submit=Draft} {state} {trigger:pagecreated} {set-metadata:my-version} 0 {set-metadata} {trigger} {trigger:statechanged|state=Approved} {increment-metadata:my-version} {trigger} {workflow} |
The This example shown uses the increment-metadata
macro to support the custom versioning of a page using a simple numeric metadata value.
...
A version change will occur : on a state change to the Approved state.
{increment-metadata:my-version}
The metadata is associated with the page. At any one point in time, the metadata value will be the same in any workflow state.
- for in our example, the metadata value when a user viewing previously published content in on the last transition to the workflow final state whilst content is currently in the a draft state
The metadata for the Confluence version
may however may be different if the page has been updated or edited in one of the workflow states.
...
The Confluence version
value is currently 9. This reflects that there have been multiple edits on the content.
A metadata value is linked to a page not a page version. Viewing a previous page version will show the current metadata value.
Other examples
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...