Aller au contenu
FR
On this page

Variables and formulas

Variables inject dynamic data into a template: they are replaced at generation time by entered or computed values. Formulas compute totals, rounding and conditions from those variables.

Writing a variable

Two equivalent syntaxes inside a text element:

  • {{client.name}} — double curly braces;
  • @client.name — short syntax.

At generation time, the form field value replaces the variable. An unfilled variable stays empty (the raw placeholder is cleaned out of the render).

System-reserved variables

These variables are never entered in the form: they are resolved by the system.

Variable Content
{{DOCUMENT.num}} Document number, assigned at issue time by numbering
{{DOCUMENT.version}} Document version in its correction chain (1 for the first version), frozen like the number
{{COMPANY.NOM}} Company name from the emitter profile (settings)
{{COMPANY.ADRESSE}} Emitter address
{{COMPANY.NIF}} Tax identification number
{{COMPANY.IBAN}} Emitter IBAN
{{COMPANY.TELEPHONE}} Emitter phone
{{COMPANY.EMAIL}} Emitter e-mail
{{COMPANY.MENTIONS}} Configured legal mentions

Case is indifferent ({{document.num}} is accepted), but the field keys themselves are French (NOM, ADRESSE, TELEPHONE…) — the content convention is to cite these reserved variables in capitals.

Variable types

The generation form infers each field type, which drives input validation and display:

Type Usage Inferred when
text Free text (default) Any other name
date Date picker The name contains "date"
currency Monetary amount "total", "ttc", "ht", "prix", "montant", "pu"
percent Percentage (VAT, discount) "tva", "remise"
number Raw number Manual setting
select Choice in a list Manual setting
image Image (signature, stamp) Image element bound to a variable
reference A registry record Variable referenced by a registry

A currency field with no explicit currency displays with the workspace's default currency (set in the workspace settings, Preferences tab); custom currencies (loyalty points, credits…) can be added there. A field declaring its own currency keeps it.

Formulas

A formula starts with = and is placed in a table cell or a variable:

={{prix_ht}} * 1.19
=SUM(Lines.total_ht)
=IF(A1>10, "above", "below")
=WORDS({{total_ttc}}, "MGA", "en")

Available operators: + - * / % ^ (arithmetic), & (concatenation), = <> < <= > >= (comparisons). Cell references (A1, B2:A8) and column keys (total_ht, or TableName.column to target another table) can be used directly.

Function catalogue

Function Purpose
SUM(x…) Sum of values (ranges and columns accepted)
AVERAGE(x…) Average
MIN(x…) / MAX(x…) Minimum / maximum
COUNT(x…) Number of values
ROUND(x, d?) Round to d decimals (0 by default)
ABS(x) Absolute value
INT(x) Integer part
SQRT(x) Square root
POWER(x, y) x to the power of y
MOD(x, y) Remainder of x / y
IF(cond, a, b?) Returns a if the condition is true, otherwise b
AND(x…) / OR(x…) Conjunction / disjunction
NOT(x) Logical negation
CONCAT(x…) Text concatenation
LEN(x) Text length
UPPER(x) / LOWER(x) Upper / lower case
WORDS(amount, currency?, locale?) Amount in words (fr/en) — e.g. =WORDS(1250, "MGA", "en")

A formula error shows in the render as a code (#PARSE!, #DIV0!, #REF!, #NAME!, #NUM!): it flags the cell to fix.

Numbering documents

The template's numbering pattern assembles tokens:

Token Meaning
{TYPE} Template prefix
{SEQ} / {SEQ0} Counter padded to 3 / unpadded (yearly reset)
{SEQ:w} Counter padded to w digits (1 to 8)
SEQ:w:M Counter padded to w, monthly reset (A = yearly, C = continuous)
{MM} Month on 2 digits
{AA} / {AAAA} Short year (26) / long year (2026)

Example: FA{SEQ:3:M}{MM}{AA} produces FA0010826 — the 001 counter restarts every month. The counter is reserved under lock: a sequence with no gaps or duplicates, even with simultaneous issues.

Registries

A variable can point to a registry: at generation, the field becomes a picker among the registry records (customer, product…) and every column of the selected record is injected ({{client.name}}, {{client.city}}…).