Functions of the formulas
Rate, Studio and Docs write their A level of a product, such as "Third party" or "Comprehensive": the covers it includes, with their values.Glossary → in the same expression language. A function is called with its name and its arguments in brackets.
| Function | What it does | Example | Where |
|---|---|---|---|
round(value, decimals?, mode?) | Rounds a number to a number of decimals (0 by default). Modes: halfUp, halfEven, halfDown, up, down, ceiling, floor; halfUp (arrondi commercial) by default. | round(premium * 1.09, 2) | Rate, Studio, Docs |
floor(value) | The whole number at or below a number. | floor(2.7) is 2 | Rate, Studio, Docs |
ceil(value) | The whole number at or above a number. | ceil(2.1) is 3 | Rate, Studio, Docs |
abs(value) | The number without its sign. | abs(-12) is 12 | Rate, Studio, Docs |
min(a, b, ...) or min(list, item => value) | The smallest of several numbers or dates, or of the items of a list. An empty list gives null. | min(premium, 5000) | Rate, Studio, Docs |
max(a, b, ...) or max(list, item => value) | The largest of several numbers or dates, or of the items of a list. An empty list gives null. | max(drivers, d => d.premium) | Rate, Studio, Docs |
clamp(value, lowest, highest) | Keeps a number between two limits. | clamp(bonusMalus, 0.5, 3.5) | Rate, Studio, Docs |
pow(value, exponent) | A number raised to a power; the same as value ^ exponent. | pow(1.02, years) | Rate, Studio, Docs |
sqrt(value) | The square root of a number. | sqrt(16) is 4 | Rate, Studio, Docs |
ln(value) | The natural logarithm of a positive number. | ln(2) | Rate, Studio, Docs |
exp(value) | e raised to a power. | exp(1) | Rate, Studio, Docs |
mod(value, divisor) | The remainder of a division; the same as value % divisor. | mod(7, 3) is 1 | Rate, Studio, Docs |
roundTo(value, step, mode?) | Rounds a number to a multiple of a step, like 5 euros or 0.05. Modes as for round; halfUp by default, “up” rounds up to the next step. | roundTo(premium, 5, "up") | Rate, Studio, Docs |
| Function | What it does | Example | Where |
|---|---|---|---|
if(condition, value, otherValue) | value when the condition is true, otherValue when it is false. Only the chosen side is computed. | if(age < 25, 1.5, 1) | Rate, Studio, Docs |
coalesce(value, fallback, ...) | The first value that is not empty (null). | coalesce(previousClaims, 0) | Rate, Studio, Docs |
isNull(value) | true when the value is empty (null), for example an optional input not given. | isNull(secondDriver) | Rate, Studio, Docs |
| Function | What it does | Example | Where |
|---|---|---|---|
today() | The calculation date: the date the calculation is made for, the same everywhere in one calculation. | yearsBetween(licenceDate, today()) | Rate, Studio, Docs |
date("YYYY-MM-DD") or date(year, month, day) | A date written as text in ISO form, or built from its parts. | date("2027-01-01") | Rate, Studio, Docs |
addDays(date, count) | A date moved by a number of days (negative to go back). | addDays(startDate, 1) | Rate, Studio, Docs |
addMonths(date, count) | A date moved by a number of months; 31 January plus one month is the last day of February. | addMonths(startDate, 1) | Rate, Studio, Docs |
addYears(date, count) | A date moved by a number of years; 29 February plus one year is 28 February. | addYears(startDate, 1) | Rate, Studio, Docs |
daysBetween(from, to) | The number of whole days from the first date to the second; negative when the second is earlier. | daysBetween(birthDate, today()) | Rate, Studio, Docs |
monthsBetween(from, to) | The number of whole months from the first date to the second; negative when the second is earlier. | monthsBetween(birthDate, today()) | Rate, Studio, Docs |
yearsBetween(from, to) | The number of whole years from the first date to the second; negative when the second is earlier. | yearsBetween(birthDate, today()) | Rate, Studio, Docs |
age(birthDate, at?) | Age in whole years on a date (the calculation date by default). | age(driver.birthDate) | Rate, Studio, Docs |
year(date) | The year of a date, as a number. | year(startDate) | Rate, Studio, Docs |
month(date) | The month of a date, as a number. | month(startDate) | Rate, Studio, Docs |
day(date) | The day of a date, as a number. | day(startDate) | Rate, Studio, Docs |
weekday(date) | The day of the week of a date, as a number: 1 for Monday to 7 for Sunday. | weekday(startDate) <= 5 | Rate, Studio, Docs |
isWeekend(date) | True when the date is a Saturday or a Sunday. | isWeekend(startDate) | Rate, Studio, Docs |
isWorkingDay(date, calendar?) | True when the date is worked in the calendar (the default calendar of the Your company as the suite knows it: its people, its records and its settings. Everything you see belongs to one organization, and nobody from another organization sees it.Glossary → when none is named): not a weekend day, a public holiday or a closing day of the organization. | isWorkingDay(startDate) | Rate, Studio, Docs |
addWorkingDays(date, count, calendar?) | A date moved by a number of working days of the calendar (the default calendar of the organization when none is named), skipping weekends, public holidays and closing days; negative to go back. Friday plus one working day is Monday. | addWorkingDays(receivedOn, 10) | Rate, Studio, Docs |
workingDaysBetween(from, to, calendar?) | The number of working days after the first date up to the second, in the calendar (the default calendar of the organization when none is named); negative when the second is earlier. | workingDaysBetween(receivedOn, today()) | Rate, Studio, Docs |
nextWorkingDay(date, calendar?) | The date itself when it is worked, else the first working day after it, in the calendar (the default calendar of the organization when none is named). | nextWorkingDay(addMonths(startDate, 2)) | Rate, Studio, Docs |
daysInYear(date) | The number of days in the year of a date: 365, or 366 in a leap year. Useful for pro-rata . | premium * daysBetween(startDate, endDate) / daysInYear(startDate) | Rate, Studio, Docs |
| Function | What it does | Example | Where |
|---|---|---|---|
upper(text) | The text in capital letters. | upper(postalCode) | Rate, Studio, Docs |
lower(text) | The text in small letters. | lower(postalCode) | Rate, Studio, Docs |
trim(text) | The text without spaces at either end. | trim(postalCode) | Rate, Studio, Docs |
length(text) | The number of characters of a text. For a list, use count(list). | length(plate) | Rate, Studio, Docs |
contains(text, part) | true when the text contains the part. Upper and lower case differ; use lower() on both to ignore case. | contains(postalCode, "75") | Rate, Studio, Docs |
startsWith(text, part) | true when the text starts with the part. Upper and lower case differ; use lower() on both to ignore case. | startsWith(postalCode, "75") | Rate, Studio, Docs |
endsWith(text, part) | true when the text ends with the part. Upper and lower case differ; use lower() on both to ignore case. | endsWith(postalCode, "75") | Rate, Studio, Docs |
concat(value, ...) | Joins values into one text; numbers and dates are written plainly. | concat("Zone ", zone) | Rate, Studio, Docs |
format
Section titled “format”| Function | What it does | Example | Where |
|---|---|---|---|
formatNumber(value, decimals?, language?) | A number written as readers of a language write it: 1 234,5 in French, 1,234.5 in English, ١٬٢٣٤٫٥ in Arabic. With decimals, exactly that many; without, up to three. The language is a A label of your own put on records to find and group them, such as "VIP" or "To check".Glossary → such as “en”, “ar” or “ar-MA” (Arabic with Latin digits); without one, the language of the document in Docs, French elsewhere. An empty value gives an empty value. | formatNumber(surface, 1, "en") | Rate, Studio, Docs |
formatMoney(amount, currency?, language?) | An amount with its currency, as readers of a language write it: 1 234,50 € in French, €1,234.50 in English, ١٬٢٣٤٫٥٠ د.م. in Arabic. The currency is a code such as “EUR” or “MAD”, given here for a number or held by a money value (formatting never converts: a money value takes no other currency); the amount takes its decimals (two for most, three for the Tunisian dinar, none for the CFA franc) unless a number of decimals is given. The language works as for formatNumber. An empty value gives an empty value. | formatMoney(total, "EUR") | Rate, Studio, Docs |
formatPercent(ratio, decimals?, language?) | A ratio written as a percentage: 0.145 gives 14,5 % in French, 14.5% in English, ١٤٫٥٪ in Arabic. Up to two decimals, or exactly as many as given. The language works as for formatNumber. An empty value gives an empty value. | formatPercent(taxRate, 1) | Rate, Studio, Docs |
formatDate(date, style?, language?) | A date, or a date and time, as readers of a language write it. Styles: short (06/10/2026), medium (6 oct. 2026), long (6 octobre 2026, the default), full (with the day of the week) and time (14:30); or a pattern such as “dd/MM/yyyy” (yyyy year, MM month, MMMM month name, dd day, EEEE weekday, HH hours, mm minutes). A date and time is written in ISO form, like “2026-10-06T14:30”, and shows the clock time it holds. The language works as for formatNumber. An empty value gives an empty value. | formatDate(startDate, "long", "en") | Rate, Studio, Docs |
spellOutNumber(value, currency?, language?) | A number or an amount in words, as letters and cheques write them: mille deux cent trente-quatre euros et cinquante centimes. With a currency (a code given here for a number, or held by a money value) the amount is rounded to its decimals and its units are named; without one, the number is written with its decimals. In French, English and Arabic; the language works as for formatNumber. An empty value gives an empty value. | spellOutNumber(total, "EUR", "fr") | Rate, Studio, Docs |
| Function | What it does | Example | Where |
|---|---|---|---|
count(list, item => condition?) | The number of items, or of the items meeting a condition. | count(drivers, d => age(d.birthDate) < 25) | Rate, Studio, Docs |
sum(list, item => value?) | The total of a list of numbers, or of a value computed for each item. | sum(coverages, c => c.premium) | Rate, Studio, Docs |
avg(list, item => value?) | The average of a list of numbers, or of a value computed for each item. An empty list gives null. | avg(drivers, d => age(d.birthDate)) | Rate, Studio, Docs |
any(list, item => condition) | true when at least one item meets the condition. | any(drivers, d => d.hasClaims) | Rate, Studio, Docs |
all(list, item => condition) | true when every item meets the condition (also true for an empty list). | all(drivers, d => d.hasClaims) | Rate, Studio, Docs |
filter(list, item => condition) | The items that meet the condition, in order. | filter(drivers, d => d.isMain) | Rate, Studio, Docs |
map(list, item => value) | A list of the value computed for each item. | map(drivers, d => age(d.birthDate)) | Rate, Studio, Docs |
append(list, item) | A copy of the list with the item added at the end, for example a coverage added to the chosen ones. | append(coverages, { code: "VOL", premium: 25 }) | Rate, Studio, Docs |
first(list) | The first item of a list, or null when it is empty. | first(drivers) | Rate, Studio, Docs |
last(list) | The last item of a list, or null when it is empty. | last(drivers) | Rate, Studio, Docs |
range(from, to) | The whole numbers from one number to another, both included. | range(1, years) | Rate, Studio, Docs |
| Function | What it does | Example | Where |
|---|---|---|---|
lookup("table", { key: value, ... }) | The first row of a Rows of rates by criteria, such as a rate per zone and age band. A lookup returns the first row whose keys all match.Glossary → whose keys match, or null. Read a value of the row with a dot after the call, as in the example. | lookup("baseRates", { age: driverAge, zone: zone }).rate | Rate |
interpolate("table", { key: value, ... }, "column") | Reads a value column of a rate table between its rows: linear interpolation on the table’s number key, the other keys matched exactly. Outside the first and last rows, the nearest row’s value is used. | interpolate("valueCoefficients", { vehicleValue: vehicleValue }, "coefficient") | Rate |
In Studio, an automation also reads responseNumber (the number of the response) and formName (the name of the form).