Versions Compared

Key

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

...

Section
titleIncrement Specification

The Increment Specification defines which number format should be applied to which document instance. For each doctype there may be one specification and in each of these specifications there may be specifications that take the doctype of the parent into account.

Code Block
languagetext
{
  "specs": [
      {
          "parentDoctypes": [],
          "parentProperty": "",
          "function": {
              "format": "",
              "increment": 1
          }
      }
  ]
}
NameDescription
specsList of doctypes increment specifications.
parentDoctypes

Comma-separated list of doctype IDs to specify for which parent document types the increment format should apply. If omitted, the format is applied to any parent doctype. Doctypes increment specifications without a doctype must be specified at the end of the list.

parentProperty

The name of the parent property to use as the prefix for the ID. This value is only used if the new document has no siblings.

functionThe increment function to create the new ID.
formatThe format specifies the number of digits of the number block.
increment

The increment for each new ID. The value must be an integer greater than zero.

To test a configuration there is a REST service at projectdoc-internal/1/increment/test that is available to logged in users.

Image RemovedImage Added

Section
titleExample of Usage

The specification is done in JSON format.

Example Box
titleExample for the Topic Doctype
Code Block
languagetext
projectdoc.doctype.requirement.auto-id-pattern:
 {
    "specs": [
        {
            "parentDoctypes": [],
            "parentProperty": "ID Prefix",
            "function": {
                "format": "5",
                "increment": 10
            }
        }
    ]
  }

The example above applies to requirement documents that are added to any parent document (parentDoctypes is empty, otherwise the parent doctype identifiers that select this specification would be listed).

The parentProperty that defines the prefix is named "ID Prefix". If this property is not found, the Prefix "ID" would be used as default. So whenever a new requirement document is created, it will check if there are already siblings, and if not, use the given prefix and the following number format to create the auto-incremented identifier.

The function defines the formatting rules. In format the digit defines the number of digits of a number block. In the example these are 5. If the number has less than five digits, it will be filled with zeros. The increment shows the next number. In the example this is a ten-numbers step. If later a requirement needs to be added between to existing requirements, there is at least some space.

If the document that references all major requirements, has an "ID Prefix" property with the value "REQ", then the generated identifier for the first requirements document will be "REQ-00010", the next will be "REQ-00020", and so forth. The first subrequirement of the second requirement will have the ID "REQ-00020-00010".

Note Box

Note the the example above show the default. These can be specified with an empty JSON document like this:

Code Block
languagetext
projectdoc.doctype.requirement.auto-id-pattern: {}

Or in one line:

Code Block
languagetext
projectdoc.doctype.requirement.auto-id-pattern: {"specs":[{"parentDoctypes":[],"parentProperty":"ID Prefix","function":{"format":"5","increment":10}}]}
Code Block
languagetext
projectdoc.doctype.requirement.auto-id-pattern:
 {
    "specs": [
        {
            "parentDoctypes": [docsection],
            "function": {
                "format": "4",
                "increment": 100
            }
        },
        {
            "parentDoctypes": [],
            "function": {
                "format": "10",
                "increment": 10
            }
        }
    ]
  }

The above example shows that the requirement documents on the first level, which are attached to a document of type docsection, have another increment block format than requirements that are attached to a document of any other type. This includes the requirement doctype itself. In other words: sub requirements have a space of 10 digits, while the root requirements have only four.

Note Box

It is not possible to control the format dependent on level. So all requirements from the second level to the last level share the same format.

...