Skip to content

ERP expressions — Quick user guide

Practical reference for the expression language (reports, calculated columns, conditions). For the full specification: GRAMATICA.md.

The basics

I want...I typeResult
A field from the row[Importe] · [Total Línea]its value
A precalculated totalAGG(baseImponible)its value
Arithmetic[Cantidad] * [Precio] * 1.21number
Text"Cliente: " + [Nombre]text
A condition[Importe] > 1000 ? "VIP" : "normal"one of the two branches
The same, in Python style"VIP" if [Importe] > 1000 else "normal"identical
Default value if it is empty[Descuento] ?? 0the first non-empty one
A fixed date#2026-06-10# · #2026-06-10 14:30#date

Empty values (null): it behaves like the database

Most used functions

FunctionExampleGives
Round(x, decimals)Round([Importe] * 1.21, 2)121.00
Abs · Floor · CeilingCeiling(2.1)3
Min(a, b) · Max(a, b)Max([Stock], 0)
Upper · Lower · TrimUpper([Nombre])"ACME"
Len(s)Len([NIF])9
Substring(s, start, length)Substring([NIF], 1, 1) (starts at 1!)first letter
Replace · PadLeft · PadRightPadLeft([Num], 6, "0")"000043"
Contains · StartsWith · EndsWithStartsWith([CP], "28")true/false
Today() · Now()constant throughout the report
Year · Month · DayYear([Fecha])2026
AddDays · AddMonths · AddYearsAddDays([Fecha], 30) (due date)date
DateDiffDays(start, end)DateDiffDays([Fecha], Today()) (age of the debt)days
IIf(cond, ifTrue, ifFalse)IIf([Cantidad] > 0, [Importe]/[Cantidad], 0)only evaluates the chosen branch
Coalesce(a, b, ...) / IsNull(a, b)Coalesce([Tarifa2], [Tarifa1], 0)first non-empty
Format(value, "format")Format([Importe], "N2") · Format([Fecha], "dd/MM/yyyy")text already formatted (Spanish)
ToDecimal · ToString · ToDateToDecimal([CodigoTexto])explicit conversion

Errors that warn you

Scripts (advanced: automations and plugins)

Where the system allows it (not in reports), a sequence of statements ending in ;:

var total = 0;
foreach (var x in Lineas)
{
    if (x > 10) { total = total + x; }
}
return total;