The SUBSTR() function extracts a defined number of characters from a string, starting at a position you specify, and returns a text string. It is handy for isolating a prefix, a code or a fixed portion of a text, for example to build an automatic numbering root for your quotes, invoices or credit notes.
The output format of the result is configured in the output field options of the formula editor: see Formula column.
Syntax
SUBSTR(texte_original, position_départ, nombre_de_caractères)
How to reference parameters in TimeTonic: $field_name for a field (link, linked-table column, number, selection, formula, text); "free text" in quotes; no quotes for numbers.
Parameters
Examples
Extract the first characters of a text
"TT-2026-01" becomes "TT".
SUBSTR("TT-2026-01", 0, 2)
Build a numbering root from a field
For a $Type field containing for example "Facture", "Devis" or "Avoir": "Facture" becomes "Fac".
SUBSTR($Type, 0, 3)
The start position begins at 0: to extract from the first character, enter 0.
Business use case: SUBSTR() is particularly useful for isolating a fixed portion of a text: a reference prefix, a product code, or an automatic numbering root 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 calculate the start position dynamically instead of hard-coding it.
Business use case: SUBSTR() is particularly useful for isolating a fixed portion of a text: a reference prefix, a product code, or an automatic numbering root 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 calculate the start position dynamically instead of hard-coding it.
Go further
LEFT()
Extracts the first characters of a text string.
Or continue with
Formula glossary
All available operators and functions, sorted by category.