# Reference Code Logic

These changes ensure that customers can generate more flexible, readable, and customizable reference codes, improving the overall experience and making it easier to meet specific business requirements.

**Variable Support:**

* New variables can now be used within reference codes to insert dynamic values such as the current year ({year}), month ({month}), day ({day}), and a constantly incrementing counter ({count}). These variables help automate the generation of reference codes that are both time-sensitive and unique.
* It is possible to have a counter, which is constantly incremented in the data base and use it as a variable {count} = current order count The count starts with 1. Every time an order is actually created, the count is incremented.

**Refined Symbol Interpretation:**

* The + symbol is now interpreted as exactly one random number (0-9)
* The ! symbol now generates exactly one random character (a-Z)
* The \* symbol now produces exactly one random symbol, either a number (0-9) or a letter (a-Z)
* An Escape Character (backslash) in front of one of the symbols means, that the symbol is printed as-is:
  * \\+ is interpreted as "+"
  * \\! is interpreted as "!"
  * \\\* is interpreted as "\*"

**Example Use Cases:**

* {year}{month}{day}-{count,4} could generate a reference code like 20250506-0023, where the date and an incrementing order number are combined.
* {count,5}-{year} could generate a code like 00023-2025, where the order count is padded to a five-digit number and followed by the year.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://teos-docs.coreledger.net/white-label-portal/admin-user-guide/portal-configuration/reference-code-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
