Special functions

Most functions require one or more parameters, that must be included between parentheses.

@assigned

Returns true if some value is assigned to the datafield (i.e., if the datafield is not equal to unassigned).

@bullets

(including @bullets-and / @bullets-or / @bullets-andor / @bullets-skipfinal / @bullets-and-skipfinal / @bullets-or-skipfinal / @bullets-andor-skipfinal)

  • parameters: either a list, or one or more values (which may themselves be lists, from which the elements will then be extracted)
  • returns a bulleted list
  • see also: @enumerate

Converts the parameter into an enumeration that will always be displayed as a bullet-set.

For example:

  • inserting @bullets(‘alpha’, ‘beta’, ‘gamma’) is identical to typing {LIST! | alpha | beta | gamma}
  • inserting @bullets-and(‘alpha’, ‘beta’, ‘gamma’) is identical to typing {AND! | alpha | beta | gamma}
Use @enumerate instead if you do not necessarily want to force the use of bullets, but instead want to rely on the applicable styling to determine how an enumeration should be shown.
The functions that include ....-skipfinal can be used if you want to avoid that the final item receives a suffix.For example, @bullets('alpha', 'beta', gamma') results in a list of three bullets, for which the last bullet (containing "gamma") will probably end at the suffix "." (or any other suffix that happens to be selected in the layout settings). To prevent such suffix from being inserted, used @bullets-skipfinal.

@capitalize

Returns the passed text, but with its first letter converted to a capital.

For example, @capitalize(‘just testing’) results in Just testing.

@capitalize-words

Returns the passed text, but with every individual word receiving an initial capital.

For example, @capitalize(‘just testing some words’) results in ‘Just Testing Some Words’.

@case

  • parameters:
    • a datafield
    • a concatenation of test-values and result-values
  • returns the first result-value for which the test-value is equal to the value of the datafield
  • see also: @if, @switch and @when

For example, @case(#employee^first-name, "Jane", "Thompson", "John", "Simpson") will return "Simpson" if the current value of the employee's first name hapens to be "John".

@cascade

  • one or more parameters of any type
  • can return any type
  • see also: @assigned

Returns the first parameter that is not equal to nothing.

For example, @cascade(#employee^last-name, #employee^first-name) would result in the value assigned to #employee^last-name if that datafield was effectively assigned some value. If no value is assigned to #employee^last-name, then the value assigned to #employee^first-name would be returned. If no value would be assigned to that datafield either, then the result would be nothing.

@clause-title

  • parameter: a #concept
  • returns the title of the clause that implements the concept (or empty text if the concept is not implemented, or is implemented but the implementing clause has no title)
  • see also: @ref-title

Returns, as a text value, the title of the first clause that implements the concept.

For example @clause-title(#liability) could result in Liability limitations agreed between the Parties.

@comma-split

  • split up a text with zero or more commas into a list of texts
  • returns a list with texts
  • see also: @semicolon-split

For example, @comma-split("alpha, beta, gamma") would result in a list with three elements ("alpha", "beta" and "gamma"). Please note that the spaces around the commas are removed.

@construct-duration

  • first parameter: an amount (e.g., 5)
  • second parameter: "year", "month", "day", "week" or "quarter" (or any of them in plural)

Returns a duration value that consists of the specified amount and unit.

Example: @construct-duration(5, "days")

@construct-currency

  • first parameter: an amount (e.g., 500 or 5.123)
  • second parameter: "USD", "EUR", "GBP" or "JPY"
  • see also: @extract-currency

Returns a currency value that consists of the specified value and currency.

For example, {@construct-currency(500, "EUR") + 1 EUR} is equal to having typed {500 EUR + 1 EUR}

@count

  • parameter: some list
  • returns a whole number
  • see also: @list

Returns the number of elements present in the list. 

For example, @count(@empty-list) results in 0, while @count(@list(‘alpha’, ‘beta’)) results in 2.

@day-of

  • parameter: a date
  • returns a whole number between 1 - 31
  • see also: @month-of and @year-of

Returns the day number (1 - 31) for the specified date.

@days-in

Returns the number of days in the duration value.

Rounding errors can occur, because averages will be used, and no specific dates, leap years, etc. will be taken into account! For example, @days-in(1 month) will result in 30.

@days-in-month

  • parameter: a date
  • returns a whole number

Returns the date of the last day of the month in the specified date.

For example, @days-in-month(2020_2_1) returns 29, because February has 29 days in the leap year 2020.

@days-between

Returns the number of full days between the two dates.

Examples:

  • @days-between(2019_2_5, 2019_2_6) will result in 1
  • @days-between(2019_2_5, 2019_3_5) will result in 28
  • @days-between(2019_2_5, 2019_8_23) will result in 199

@difference

  • parameters: two lists (the second parameter will be automatically converted to a list)
  • returns a list
  • see also: @intersection and @union

Returns the difference between the two lists, i.e. it takes the first list, removes all the elements of the second list that are also present in the first list, and then returns the result.

Examples:

  • @difference(@list(1, 2, 3), @list(1)) results in a list with elements 2 and 3
  • @difference(@list(1, 2, 3), 1) results in a list with elements 2 and 3 — note that the second parameter was automatically converted to @list(1)
  • @difference(@list(1, 2, 3), @list(1, 2, 3)) results in an empty list, because both lists share the same elements
  • @difference(@list(1, 2, 3), @list(1, 1, 2, 2, 3)) also results in an empty list
  • @difference(@list(1, 1, 2, 2, 3, 3), @list(1, 2, 3)) also results in an empty list
  • @difference(@list(1, 1, 2, 2, 3, 3), @list(1, 2)) results in a list with elements 3 and 3

@doctitle

  • no parameters
  • returns text

Returns the title of the current document. (When called insider a binder, the title of the document that contains the function-call will be returned.)

@dutch

Returns true if the currently active language is Dutch, false otherwise.

@dynamic-fullnr

  • parameter: some whole number
  • returns text
  • see also: @fullnr

Returns the specified number either as-is (e.g., "30"), or in letters (e.g., "thirty"), or in letters with parenthesized numbers (e.g., "30 (thirty")), depending on the styling settings.

@earliest

  • parameter: two dates
  • returns: a date
  • see also: @latest

Returns the earliest of the two dates.

For example, @earliest(2018_01_05, 2010_01_01) returns 1st January 2010.

@email

  • parameter: an email address (between quotes)
  • optional second parameter with visible text (if missing, the email address will be printed)
  • returns: a hyperlinked email address
  • see also: @link

For example @email("info@clausebase.com") returns a clickable link to an email address info@clausebase.com, while @email("info@clausebase.com", "please email us") returns a clickable link to the same email address, but visibly the text "please email us" will be shown.

@empty-list

  • no parameters
  • returns a list
  • see also: @list

Returns a list with no elements.

@english

  • no parameters
  • returns true or false
  • see also: @dutch and @french

Returns true if the currently active language is English, false otherwise.

@enumerate

(Including @enumerate-and / @enumerate-or / @enumerate-andor / @enumerate-numbered / @enumerate-numbered-and / @enumerate-numbered-or / @enumerate-numbered-andor. All of them also include an alternative version with suffix -skipfinal, that skips the suffix for the final item.)

  • parameters: either a list, or one or more values (which may themselves be lists, from which the elements will then be extracted)
  • returns an enumerated list (or nothing, if the list is empty)
  • see also: @bullets

Converts the parameter into an enumeration, as if {AND | … | … } was typed in. Depending on the applicable styling, such enumeration may get displayed in an “inline” list, or instead as a bulleted list.

For example:

  • inserting @enumerate(‘alpha’, ‘beta’, ‘gamma’) is identical to typing {LIST | alpha | beta | gamma}
  • inserting @enumerate-or(‘alpha’, ‘beta’, ‘gamma’) is identical to typing {OR | alpha | beta | gamma}
The function versions that include -...numbered...- in their name, will be forced to show numbers when formatted as an inline list.For example, @enumerate('alpha', 'beta', 'gamma') can — depending on the layout settings — result in "alpha, beta and gamma". If instead you use @enumerate-numbered('alpha', 'beta', 'gamma'), then numbers will be inserted in between — in many layout settings this will for example look like "(i) alpha, (ii) beta and (iii) gamma". This is similar to typing {AND | 1. alpha | 2. beta | 3. gamma}.If, in accordance with the layout settings, the @enumerate-numbered-... happens to result in a bulleted list, then the ...-numbered-... part would make no difference.

@extract-currency

Extracts the currency from the currency-value.

For example, @extract-currency(5 EUR) would extract the value "EUR".

@extract-number

Extracts the amount from the currency-value.

For example, @extract-amount(5 EUR) would extract the value 5.

@first-day-of-month

Returns the date of the first day of the month in the specified date.

For example, @first-day-of-month(2019_02_05) returns 1st February 2019.

@floor

  • parameter: a (whole or fractional) number
  • returns: a whole number
  • see also: @round

Rounds the given number to the lowest integer — i.e., the decimal numbers are simply cut off. This function is typically used to avoid the rounding (to the nearest number) that will occur with automatic conversions.

Examples:

  • @floor(123.6) will result in 123
  • @floor(45) will result in 45
  • {100 / 6.0} will result in 16.6667, while {@floor(100 / 6.0)} will result in 16

@format-plain-nr

  • parameter: a (whole or fractional) number
  • returns text
  • see also: @format-nr

Formats the given number as a plain number, without any decimals or thousands grouping.

Examples:

  • @format-plain-nr(100 / 3.0) results in "33". Note that {100 / 3.0} would result in "33.3333" or "33,3333", depending on the locale settings
  • @year-of(2019_01_16) will result in "2.019" or "2,019", depending on the locale settings. However, @format-plain-nr(@year-of(2019_01_16)) will result in a plain "2019"
Note in the examples above that rounding to the nearest number will occur.

@format-nr

  • first parameter: a number with currency, or a (whole or fractional) number
  • second parameter: either a text containing a sample, or a whole number
  • returns text
  • see also: @format-plain-nr

If the second parameter is a text, then ClauseBase will format the first parameter in accordance with the sample given in the second parameter. ClauseBase will analyse the way the sample is constructed, and try to mimic this when formatting the given number, taking into account the following features:

  • whether or not a decimals-symbol (comma or dot) is used, and — if a decimals-symbol is indeed used — the amount of decimal numbers
  • for currencies: the position of the currency (before or after the numbers) and whether to use a word (EUR, USD, ...) or a symbol instead (€, $, ...)

Examples (assuming continental European styling for numbers):

  • @format-nr(4567.89 EUR, "EUR 123") will result in "EUR 4.568"
  • @format-nr(4567.89 EUR, "123") will result in "4.568€"
  • @format-nr(4567.89 EUR, "€123") will result in "€4.568"
  • @format-nr(4567, "123.4567") will result in "4.567,0000"
  • @format-nr(4567, "123.4") will result in "4.567,0"
  • @format-nr(4567.89, "123") will result in "4.568"

If the second parameter is a whole number instead, then the number will be formatted in accordance with the default styling, with the specified amount of decimals numbers. Examples (assuming continental European styling for numbers):

  • @format-nr(4567.89 EUR, 0) will result in "4.568 EUR"
  • @format-nr(4567.89 EUR, 1) will result in "4.567,9 EUR"
  • @format-nr(4567 EUR, 2) will result in "4.567,00 EUR"
  • @format-nr(4567, 4) will result in "4.567,0000"
  • @format-nr(4567.789, 4) will result in "4.567,7890"
Note in the examples above that rounding to the nearest number will occur.

@french

Returns true if the currently active language is French, false otherwise.

@fullnr

Converts the amount into text, according to the current language. If a floating point number is passed, then the part after the decimal point is also included. If a currency is passed, then currency is also added. Examples:

  • @fullnr(365) will result in three hundred and sixty-five in English
  • @fullnr(365) will result in three hundred and sixty-five in English
  • @fullnr(12.340 EUR) will result in douze virgule trente-quatre EUR in French
  • @fullnr(1234.56) will result in duizend tweehonderdvierendertig komma zesenvijftig in Dutch
The maximum number you can use in ClauseBase, is 99.999.999.999 (99 billion etc).

@if

  • first parameter: a true/false value
  • second and third parameter: any kind of value
  • see also: @case, @switch and @when

Returns the second parameter if the first parameter is true, otherwise returns the third parameter.

This function can be used to create conditions within a parameter list, which can come in handy to avoid overly complex nesting of { ... } conditions.

Examples:

  • @if(5 > 4, "alpha", "beta") will result in alpha
  • @if(#contract^value > 100, "large value", "low value") will result in "large value" when the datafield #contract^value is higher than 100, otherwise it will result in "low value"

@image

See How to insert images

@implemented

Returns true if the specified concept is implemented in the document, i.e. if some clause is present that textually represents this concept. (This will technically be the case when some clause contains an “implements” link towards the concept.)

@implemented-all

Returns true if @implemented is true for all of the passed concepts. Returns false if @implemented is false for any of the passed concepts.

@implemented-any

Returns true if @implemented is true for any of the passed concepts. Returns false if @implemented is false for all of the passed concepts.

@index

  • no parameters
  • returns a whole number

Returns the current iteration number if this function is called from within a loop (e.g., when repeating a row in a table, or when looping through repeating clauses). This function will return zero if used outside a loop.

Note that (unlike most programming languages) the returned number is one-based, i.e. the first iteration in a loop will be one (not zero).

@intersection

  • parameters: two lists (the second parameter will be automatically converted to a list)
  • returns a list
  • see also: @difference and @union

Takes the first list, and removes each element that does not also appear in the second list.

Examples:

  • @intersection(@list(1, 2, 3), @list(3)) will result in a list with element 3
  • @intersection(@list(1, 2, 3), 3) will result in a list with element 3 (note that the second parameter was automatically converted to a list)
  • @intersection(@list(1, 2, 3), @list(1, 2, 3)) will result in a list with elements 1, 2 and 3
  • @intersection(@list(1, 2, 3), @list(4, 5, 6)) will result in an empty list

@is-plural

  • parameter: a defined term (#concept)
  • returns true or false
  • see also @is-singular

Returns true if the preferred number for the defined term is plural; otherwise returns false.

For example, @is-plural(#employee) will return true if the conceptlabel used for concept "employee" defaults to the plural form.

@is-singular

  • parameter: a defined term (#concept)
  • returns true or false
  • see also @is-plural

Returns true if the preferred number for the defined term is singular; otherwise returns false.

For example, @is-singular(#employee) will return true if the conceptlabel used for concept "employee" defaults to the singular form.

@last-day-of-month

Returns the date of the last day of the month in the specified date.

For example, @last-day-of-month(2019_02_05) returns 28th February 2019.

@latest

  • parameter: two dates
  • returns: a date
  • see also: @earliest

Returns the latest of the two dates.

For example, @earliest(2018_01_05, 2010_01_01) returns 5th January 2018.

  • parameter: URL, and optionally an alternative presentation string
  • returns: a clickable hyperlink
  • see also: @email

Returns a clickable link to the specified URL. (If http:// of https:// is not added, http:// will be added automatically.)

For example, @link("www.clausebase.com") returns a clickable link to www.clausebase.com, while @link("www.clausebase.com", "ClauseBase website") returns a hyperlink to the same URL, but with the visible text being

@list-if-all

  • parameters: one or more, of any type
  • returns either a list, or nothing

Returns all the parameters that are passed, if none of them are undefined. If any of them is undefined, then the result will be nothing.

For example, @list-if-all(5, 6, undefined) will be nothing, while @list-if-all(5, 6, 7) will result in @list(5, 6, 7).

@lookup

  • parameters:
    • value to lookup
    • source-field (of type repeating-field)
    • target-field (of type repeating-field)
  • returns the value of the target-field that corresponds to the value to lookup, otherwise null

For example, assume you have a repeating-list #xxx^first-names and another repeating-list #xxx^last-names. @lookup("Daniel", #xxx^first-names, #xxx^last-names) will then result in the last name of Daniel (if found)

@lowercase

Returns the passed text, with all letters converted to lowercase. For example, @lowercase(‘He sees Fred walking in Stockholm’) results in he sees fred walking in stockholm.

@month-of

Returns the month number (1 - 12) of the specified date.

For example, @month-of(2018_4_2) returns 4.

@months-between

Returns the number of full months between two dates.

Examples:

  • @months-between(2019_2_5, 2019_2_6) will result in 0
  • @months-between(2019_2_5, 2019_3_5) will result in 1
  • @months-between(2019_2_5, 2019_8_23) will result in 6

@months-in

Returns the number of months in the duration value.

@nth

  • first parameter: a list
  • second parameter: a whole number

Returns the element at the specified index within the (repeating) list.

Examples:

  • @nth(@list(100, 200, 300), 1) will result in 100
  • @nth(@list(100, 200, 200), 55) will result in an error (only indices 1, 2 or 3 would be valid)
Note that — unlike most programming languages — the index is one-based, i.e. the first index is one and not zero.

@one-else

  • first parameter: a whole number
  • second and third parameter: text
  • returns text
  • see also: @one-else-nr

Returns the second parameter if the first parameter is equal to 1 or -1. In all other cases, returns the third parameter.

This function is typically used as a shortcut form — see the examples below.

Examples:

  • @one-else(1, "unit", "units") will result in "unit". It would be similar to writing {#some^datafield = 1: unit | else: units}
  • @one-else(3, "unit", "units") will result in "units"

@one-else-nr

  • first parameter: a whole number
  • second and third parameter :text
  • returns the number, followed by the text
  • see also @one-else

Returns the number, followed by:

  • the second parameter if the first parameter is equal to 1 or -1;
  • in all other cases, returns the third parameter.

This function is typically used as a shortcut form — see the examples below.

Examples:

  • @one-else(1, "unit", "units") will result in "1 unit". It would be similar to writing {#some^datafield = 1: 1 unit | else: #some^datafield units}
  • @one-else(3, "unit", "units") will result in "3 units"

@percent-divide

  • parameters: two numbers
  • returns a number

Divides the first number by the second number, multiplies the result by 100, and returns the final result. Typically used to calculate a percentage. 

For example, @percent-divide(5, 20) returns 25,00 — because 5 is 25% of 20.

@placeholder

  • parameter: text (or some parameter that can be converted to text)
  • returns a placeholder with the specified text

The placeholder will be formatted in accordance with the placeholders-styling (part of the References styling).

@plural

  • parameter: #concept
  • returns text (label of the concept)
  • see also: @singular

Returns the label of the passed concept, in plural form if possible.

@quarters-in

Returns the number of full quarters in the duration value.

For example, @quarters-in(2 years) will result in 8.

@range

  • parameters: two numbers
  • returns a list of numbers

Returns a list with numbers between the two passed numbers (including those numbers themselves).

For example, @range(1, 5)results in a list with elements 1, 2, 3, 4 and 5.

If the second number is smaller than the first number — e.g., @list(5, 3) — the resulting list will be empty.

@ref-if

  • parameter: #concept
  • returns a reference, or nothing
  • see also: @implemented

Returns a reference if the concept is implemented, otherwise results in nothing. Calling @ref-if(#concept) is largely similar to calling {@implemented(#concept): §concept}, but will not result in an error message if the concept would happen to not be implemented.

@ref-title

  • parameter: #concept
  • returns a reference, followed by the title of the referenced clause between parentheses
  • see also: @clause-title

Returns a reference if the concept is implemented, followed by the title of the referenced clause between parentheses. (If the concept is not implemented, it results in nothing).

For example, @ref-title(#liability) may result in article 2 (Liability)

@round

  • parameter: a (whole or fractional) number
  • returns: a whole number
  • see also: @floor

Rounds the given number to the nearest integer. This function is similar to the automatic conversions applied by ClauseBase when converting between value types.

Examples:

  • @round(123.6) and @round(123.5) will both result in 124
  • @round(123.49) will result in 123

@semicolon-split

  • split up a text with zero or more semicolons into a list of texts
  • returns a list with texts
  • see also: @comma-split

For example, @semicolon-split("alpha; beta; gamma") would result in a list with three elements ("alpha", "beta" and "gamma"). Please note that the spaces around the semicolons are removed.

@shrink-level

  • no parameters
  • returns the current shrinking-level as a number (0 if no shrinking applies, otherwise 1 to 4)

This special function is most relevant to disable/enable clauses based on the shrinking level that happens to apply. For example, inserting @shrinking-level > 2 would case a certain clause to only be shown when the shrinking level is 3 or 4.

@singular

  • parameter: #concept
  • returns text (label of the concept)
  • see also: @plural

Returns the label of the passed concept, in singular form if possible.

@singular-plural

  • first parameter: a whole number
  • second parameter: a defined term (#concept)
  • see also: @one-else

Returns the singular form of the specified concept if the first parameter is equal to one; otherwise returns the plural form of the specified concept.

For example, @singular-plural(1, #concept) will return the singular form of the conceptlabel assigned to #concept.

@sort

  • parameter: either a list, or one or more values (which may themselves be lists, from which the elements will then be extracted)
  • returns a sorted list of texts

Returns the passed list of texts, but alphabetically sorted. For example, @sort(@list(‘gamma’, ‘alpha’, ‘delta’)) results in a list with the same elements, but in the order ‘alpha’, delta’, ‘gamma’.

Be aware that the sorting procedure can result in surprises. For example, in @sort(@list(‘item 10’, ‘item 1’)), the ‘item 1’ will be put before the ‘item 10’, because the ‘item 1’ is shorter than ‘item 10’.

@str

  • parameters: anything convertible to text

Returns a text parameter that converts all of the parameters into text, and concatenates them together into a single text.

For example, @str(5, " ", 3 days, #employee) may — depending on the current concept-label for #employee — convert to "5 3 days the Employee".

This can be especially useful when you want to deviate from ClauseBase's default spacing system. For example, in the following text:

alpha " #beta " gamma

the spaces around the #beta will disappear in the final result, because this is typically what you want. If for some specific reason you intend to keep this spacing, you can use @str('alpha "', #beta, ' " gamma'). The conversion to @str will cause all parameters to be concatenated into a single text, that will not be further space-processed by ClauseBase.

@switch

  • parameters: a concatenation of tests and values
  • returns the first value for which the test is successful
  • see also @if, @when and @case

For example, @switch(1 > 3, "one is greater than three", 2 > 20, "two is greater than twenty", ("alpha" = "alpha"), "alpha is equal to alpha") will return "alpha is equal to alpha".

@tab

  • parameter: the relative position (0 to 10) of the tab, as compared to
  • inserts a tab
  • see also @tab-u, @tab-d, @rtab, @rtab-u and @rtab-d

Inserts a tab at the specified position:

  • The r- versions insert a right-aligned tab (instead of the default left-aligned tab).
  • The -u versions insert a tab with preceding underscores.
  • The -d versions insert a tab with preceding dots.

For example, @rtab-u(5) inserts a right-aligned tab in the horizontal middle of the paragraph, preceded by dots.

Don't use tabs in table columns with automatic widths, because the results are unpredictable. Make sure that the table alignment is set to fill the entire width, and that the width of the columns is not automatically calculated.

@tag-implemented

  • parameter: a string

Returns true when some clause that is currently visible in the document implements the specified tag.

@text-part

  • parameter: a clause-part (e.g., "@ALPHA")
  • converts the clause-part into a text

Converts the entire clause-part into a static text parameter. Please note that all newlines are thereby converted into spaces.

For example,

See @text(@ALPHA)

ALPHA = this is a test

and this also

would cause the text "this is a test and this also" (notice the space between the two parts) to be converted into a text-parameter. This text-parameter could then be used in other calculations.

Only use this special-function when strictly necessary, because it slows down the od

@today

  • no parameters
  • returns a date

Returns today's date.

Note that this will cause a document to have a different output depending on the day it is exported to PDF or .DOCX.

@union

  • parameters: one or more(which may themselves be lists, from which the elements will then be extracted)
  • returns a list
  • see also: @difference and @union

Takes the first list, and adds all elements from the second list that are not already present in the first list.

Examples:

  • @union(@list(1, 2, 3), @list(3)) will result in a list with elements 1, 2 and 3
  • @union(@list(1, 2, 3), @list(4)) will result in a list with elements 1, 2, 3 and 4
  • @union(@list(1, 2, 3), @list(4, 4, 4, 4)) will result in a list with elements 1, 2, 3, 4, 4, 4

@uppercase

Returns the passed text, with all letters converted to uppercase. For example, @uppercase(‘alpha beta gamma’) results in ALPHA BETA GAMMA.

@user-first-name

@user-last-name

@user-tags

  • no parameters
  • returns a text-list of all the tags assigned to the current user

@week-nr

  • parameter: a date
  • returns a whole number

Returns the number (1 - 52) of the week within the year.

For example, @week-nr(2018_4_5) returns 14.

@weekday-nr

  • parameter: a date
  • returns a whole number

Returns the number of the day (1 = Monday, 7 = Sunday) for the specified date.

@weeks-in

Returns the number of weeks in the duration value.

For example, @weeks-in(1 year) results in 52.

@weeks-between

Returns the number of full weeks between two dates.

Examples:

  • @weeks-between(2019_2_5, 2019_2_6) will result in 0 (only one day difference)
  • @weeks-between(2019_2_5, 2019_3_5) will result in 4

@when

  • parameters: a test-expression and a value
  • returns the value if the test-expression evaluates to true
  • see also @if, @case and @switch

For example, @when(1 > 0, "one is greater than zero") will return "one is greater than zero", while @when(1 > 10, "one is greater than ten") will return nothing.

@year-of

Returns the year of the specified date.

For example, @year-of(2018_4_2) returns the number 2018.

If the result of this function is directly inserted into the text, then you probably want to use @format-plain-nr to prevent thousands grouping symbols. For example, @year-of(2018_4_2) will result in "2.018" under continental European formatting, which is probably not what you want. To remove the period from the output, use @format-plain-nr(@year-of(2018_4_2)).

@years-in

Returns the number of years in the duration value.

For example, @years-in(4 year) results in 4, while @years-in(36 months) results in 3.

@years-between

Returns the number of full years between two dates.

Examples:

  • @years-between(2019_2_5, 2019_2_6) will result in 0 (only one day difference)
  • @years-between(2019_2_5, 2020_2_5) will result in 1
  • @years-between(2019_2_5, 2020_2_4) will result in 0 (just a day short of one full year)


How did we do?


Powered by HelpDocs