Setting specific formats for requirement reference prefixes

When users create requirements, they must give a reference prefix. If there is a specific format for referencing requirements within your organisation, Key Users can ensure that a user who enters an invalid reference prefix will not be able to publish the requirement. They do this by setting a Format Mask, a predefined code which the software will use to check the validity of user inputs. This will help reduce user error and ensure that all requirements on your Panacea site are properly accounted for.

N.B. To set-up a Reference Prefix, the Key User must have access to Sourcing > Settings. If you do not have access, please contact your site administrator to set-up. 

Setting up a Reference Prefix Format

  • As a key user, log onto your Panacea site.
  • Using the toolbar on the left, go to Sourcing > Settings.
  • On the page that you are now taken to, go to the “Reference Prefix Format” tab.
  • Ensure that “Enable Reference Prefix Format Mask” is ticked.
  • Edit the details in the textbox where it says “Format Mask (Regex):”.
    1. Please use the guide below (“How to write a Format Mask”) to help with this.
  • Edit the ToolTip Message, giving a clear description of what format the references should be written in.
    1. For example, if the generic format is something like “ABC-12”, the message might read: “Must be written as three letters, followed by a hyphen (‘-’) and then two numbers.”
  • Edit the Error Message. This will be what a user sees if they input a reference prefix in the wrong format.
    1. This can be something general and simple, for example: “Invalid reference prefix format. Please check your entry.”
  • When finished, click the “Save” button at the bottom of the page.

 

How to write a format mask code

Format masks are written using a variety of symbols, letters and numbers on your keyboard, which are assigned different functions. All format mask codes must start with a caret (^) and end with a dollar sign ($).

If there are different types of reference prefix used in your organisation, you may wish to set multiple format masks. To do this, type each code into the same box with a caret (^) and dollar sign ($) at the beginning and end of each, and separate them with a vertical line (|).

Some examples are at the end of the article, and below is a full key of the different symbols and functions you can use. When creating a code, we recommend that you start by clearly defining the component parts of the format you want to set and the order in which they should appear.

For example, you may want a prefix format of AB/12345. This can be broken down into:

  • two capital letters
  • a forward slash
  • five numbers

Having broken it down in this way, refer to the key and write on a word document or a piece of paper how each component would be described in a format mask code. Finally, bring these symbols together to create a short line of code which can be typed into the relevant section on the “Reference Prefix Format” tab. The examples at the end of this article will also help to outline this process.

We believe this will be enough to help you set reference prefixes yourself, but also recognise that writing out lines of code can be a little confusing! If you have tried doing this yourself but still require assistance, please do not hesitate to contact our support team to assist!

 

Key

  • ^ - start of code
  • $ - end of code
  • | - separation between two codes

  • [ ] - to indicate the valid characters a user can input, put them between square brackets. For example:
    1. [A-Z]                      - any capital letter from A to Z
    2. [a-z]                       - any lower-case letter from a to z
    3. [A-Za-z]                - any letter, capital or lower-case
    4. [AaDdJj]               - only the letters specified: A, D and J, capital or lower-case
    5. [0-9]                      - any number from 0 to 9
    6. [A-Z0-9]               - any capital letter or number

  • { } - to indicate how many of these characters should be used, type the relevant number between curly brackets immediately afterwards. For example:
    1. [A-Z]{3}                - three of any capital letter from A to Z
    2. [0-9]{4}                - four of any number from 0 to 9
    3. [A-Za-z0-9]{1}    - one of any letter or number

  • (?: ) – if you want to use a specific phrase/string of characters, you specify the case sensitive phrase after the semicolon. For example:
    1. (?:PANACEA)      - to use phrase “PANACEA”
    2. (?:PROC12)         - to use phrase “PROC12”
  • \ - use a backslash to indicate that a specific piece of punctuation is required. On its own, this will mean that a space is required. By typing a symbol afterwards, you can indicate other types of punctuation. For example:
    1. \              - requires a space
    2. \.             - requires a full stop
    3. \-             - requires a hyphen
    4. \/            - requires a forward-slash
    5. \(             - requires a bracket

  • \d - if your references include dates in them, you can indicate this with a backslash followed by a lower-case letter ‘d’. Each \d represents a single digit of the date. Punctuation can be added after each \d where required, without the need for an additional backslash. For example:
    1. \d\d\d\d                              - requires a date with four digits, like 2019
    2. \d\d\d\d-\d\d                   - requires a date range indicated with a hyphen, like 2021-22
    3. \d\d.\d\d.\d\d\d\d         - requires a complete date with full stops, like 14.03.2024

Examples

A Key User wants to ensure that requirement reference prefixes follow the format of two capital letters and two numbers:

  • two capital letters -          [A-Z]{2}
  • four numbers -                  [0-9]{4}

They write out the list as above, with the relevant symbols next to each component part. They ensure that they also begin and end their code with a caret (^) and a dollar sign ($). The code they therefore create is as follows:

^[A-Z]{2}[0-9]{4}$

With this format mask, an example prefix could be: HG9427

 

Another Key User wants change the prefix format to always start with “PS” and then 5 numbers:

  • Capital P                               [P]{1}
  • Capital S                                [S]{1}
  • five numbers -                   [0-9]{5}

Again, they write out the list as above, with the relevant symbols next to each component part. They also ensure that this code begins with a caret (^) and ends with a dollar sign ($). The new code they create is therefore as follows:

                ^[P]{1}[S]{1}[0-9]{5}$

With this format mask, an example prefix could be: PS27098

 

A third Key User wants to make it so that both these formats are options. Again, they write out the lists above, with the relevant symbols next to each component part. They write out the codes with a caret (^) at the beginning and the dollar sign ($) at the end. They then type both codes in the Format Mask box, separating them with a vertical line (|). The final code they type is therefore as follows:

^[A-Z]{2}[0-9]{4}$|^[P]{1}[S]{1}[0-9]{4}$

With this format mask, an example prefix could be EF1123, or it could be PS45789.

A fourth Key User wants to make the prefix format to always have “TEND24” and then 2 capital letters and 3 numbers:

  • Phrase “TEND24”             (?:TEND24)
  • 2 capital letters                  [A-Z]{2}
  • 3 numbers                          [0-9]{3}

Again, they write out the list as above, with the relevant symbols next to each component part. They also ensure that this code begins with a caret (^) and ends with a dollar sign ($). The new code they create is therefore as follows:

                ^(?:TEND24)[A-Z]{2}[0-9]{3}$