In a column formula , the SUBSTR() function extracts a defined number of characters from a string, starting from a position you specify. It is useful for isolating a prefix, a code, or a fixed portion of a text.
For example, you can use it to create an automatic numbering prefix for your quotes, invoices, or credit notes.
-
Text function name:
SUBSTR()
Syntax
SUBSTR(original_text, start_position, number_of_characters)
Function parameter calls in TimeTonic:
- $field_name = field (link, linked table column, number, selection, formula, text...).
- "free text" = free text to add within quotes.
- do not use quotes for numbers.
Parameters
| Parameter | Description |
|---|---|
original_text |
The source string (column or text) from which to extract characters. |
start_position |
The position of the first character to extract. Counting starts at 0: the first character has index 0. |
number_of_characters |
The number of characters to extract starting from the start position. |
Example
1. To extract the first characters of a text:
SUBSTR("TT-2026-01", 0, 2)Result: "TT"
2. To create a numbering prefix from a $Type field (containing for example “Invoice”, “Quote”, or “Credit Note”):
SUBSTR($Type, 0, 3)
Result: "Inv" for the value “Invoice”.
Notes
- The start position begins at 0: to extract from the first character, specify
0.
Return type
The function returns a text string.
The output type format of the result can be configured in the output field options of the formula editor. For more details, see Output format options in the Formula Column article.
Business use case
SUBSTR() is especially useful for isolating a fixed portion of a text: reference prefix, product code, or automatic numbering prefix for quotes, invoices, or credit notes depending on the document type.
Best practice
When the position to extract varies from one record to another, combine SUBSTR() with FIND() or LENGTH() to dynamically calculate the start position instead of hardcoding it.