Formulas
A level of a product, such as "Third party" or "Comprehensive": the covers it includes, with their values.Glossary → give values to fields in Compute steps, decide Branch cases, give the keys of a Lookup and the values passed to A model of a tariff that the main model calls, once or once per item of a list, such as the surcharge of each insured person.Glossary →, and fill the messages of an End step. Rate and Studio write their formulas in the same language. The editor completes names as you type, found by their key or by the names people read; shows what each function does, with its arguments and an example; inside a function’s brackets, shows the argument being typed; and marks a problem before you run anything.
Values
Section titled “Values”| Kind | Written |
|---|---|
| Numbers | 12, 12.5 (calculated exactly, in decimal, with no rounding error) |
| Texts | "Zone A" or 'Zone A' |
| Yes or no | true, false |
| No value | null |
| Dates | date("2027-01-01"), date(2027, 1, 1): calendar dates, with no time and no time zone |
| Lists | [1, 2, 3] |
| Items | { age: 30, zone: "A" } |
A field is written by its key: driverAge, vehicleValue. A value an option carries, or a value of an item, is read with a dot: usage.coefficient, first(drivers).birthDate.
Operators
Section titled “Operators”From the weakest to the strongest:
condition ? value : otherValueor(also||),and(also&&),not(also!)- comparisons
==(also=),!=(also<>),<,<=,>,>=, andin(zone in ["A", "B"]) +,-*,/,%^(a power;-2^2is-4, as in mathematics)
and, or, ?: and if() only compute the side they need: b != 0 ? a / b : 0 never divides by zero. + adds numbers or joins two texts, but mixing them is an error rather than a silent join.
Functions
Section titled “Functions”| Family | Examples |
|---|---|
| Numbers | round(premium * 1.09, 2), roundTo(premium, 5, "up"), min(premium, 5000), clamp(bonusMalus, 0.5, 3.5) |
| Conditions | if(age < 25, 1.5, 1), coalesce(previousClaims, 0), isNull(secondDriver) |
| Dates | today(), age(birthDate), yearsBetween(licenceDate, today()), addMonths(startDate, 1), daysInYear(startDate) |
| Texts | upper(postalCode), startsWith(postalCode, "75"), concat("Zone ", zone) |
| Formatting | formatMoney(premium, "EUR"), formatNumber(surface, 1), formatPercent(taxRate), formatDate(startDate, "long", "en"), spellOutNumber(total, "EUR") |
| Lists | count(drivers, d => age(d.birthDate) < 25), sum(coverages, c => c.premium), filter, map, first, last |
| Tables | lookup("baseRates", { age: driverAge, zone: zone }).rate, interpolate("table", { ... }, "column") |
d => ... is a small formula applied to each item of a list. today() is the calculation date: the same everywhere in one calculation, and the date a Inputs or answers saved with the result they must give, tried again after each change. Rate and Studio both keep them.Glossary → or a request pins.
The formatting functions write a value for readers: a number, an amount with its currency, a percentage or a date as French, English or Arabic write them, or an amount in words, as in a letter. They take the language as text, such as "fr", "en", "ar", or "ar-MA" for Arabic with Latin digits; without it, they write French. formatMoney(1234.5, "EUR") gives 1 234,50 €, formatMoney(1234.5, "EUR", "en") gives €1,234.50, and spellOutNumber(1234.5, "EUR") gives mille deux cent trente-quatre euros et cinquante centimes. A number formatted this way is a text: compute with the number, and format it last.
The full list, with what each function does and an example, is on the Functions reference page.
Messages
Section titled “Messages”In an End step’s Message, put a formula between double braces to insert a value: Conducteur de moins de {{ minAge }} ans. Write an amount with formatMoney so that it reads as a reader of the language writes it: {{ formatMoney(vehicleValue, "EUR", "en", 0) }} gives €60,000 in English and 60 000 € in French.
Rounding
Section titled “Rounding”A number field can keep a number of decimals; every value given to it is rounded with its mode: Half up (arrondi commercial) by default, also Half to even (banker’s), Half down, Always up (away from zero), Always down (toward zero), Toward plus infinity and Toward minus infinity. round() and roundTo() take the same modes.
Limits
Section titled “Limits”A calculation stops with a clear message when it does too much work, for example when a For each step handles too many list items. A For each goes through at most 10,000 items, and one calculation runs at most 100,000 steps, 16 levels of sub-models deep, handling at most 5,000,000 list items. The message points to a cheaper way, such as previous instead of going through every earlier round.
When something goes wrong
Section titled “When something goes wrong”The editor lists the problems of each formula as you type, with where they are and how to fix them, often with a suggestion (“did you mean driverAge?”). The messages are listed on the Messages reference page.
Under each formula, a line says what it gives (a number, a date, a value of a list…) and says so when that is not what the place needs, for example a text where a condition needs yes or no. Inside lookup("...") and interpolate("..."), the editor suggests the keys of the Everything Rate needs to price one insurance product: its models, rate tables, lists of values and constants.Glossary →’s 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 →. Rate and Studio share this editor.