Lists
@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 if at least one item results in output (no result if an empty list or item without output is passed)
see also: @enumerate
Converts the parameter(s) 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.
@count
parameter: some list
returns a whole number
see also: @list and @length (for calculating the length of text)
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.
@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
@distinct
single parameter is a list of elements
returns a list in which all the duplicate elements are removed
see also:
@is-duplicate
For example, @distinct(@list(1, 2, 3, 3, 4, 4, 4, 5))
will return @list(1, 2, 3, 4, 5)
, while @distinct(@list("alpha", "gamma", "beta", "beta"))
will return @list("alpha", "gamma", "beta")
.
@empty-list
no parameters
returns a list
see also:
@list
For example, @empty-list
— no parameters or parentheses necessary — returns a list with no elements.
@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.
@filter
parameters:
a list
a filtering expression, using
@x
as a placeholder for the actual element
results in the filtered list
see also
@filter-indices
The specified list will be filtered using the expression contained in the second parameter. For example, @filter(@list(1, 2, 3, 4), @x < 3)
will result in @list(1, 2)
because each element is checked for being smaller than 3.
The expression can be as complex as you want, and can operate on different data types. For example, @filter(@list("alpha", "beta", "gamma"), not(@x = "gamma") or @x = "delta")
will result in @list("alpha", "beta")
.
@filter-indices
parameters:
a list
a filtering expression, using
@x
as a placeholder for the actual element
results in a list containing the (one-based) indices of the elements that passed the test
see also
@filter
and@filter-by-indices
This function works similar to @filter
, but will result in a list of indices (one-based) of those elements that passed the test.
For example, @filter-indices(@list(1, 2, 3, 4), (@x < 4) and (@x > 1))
will result in @list(2, 3)
.
@filter-by-indices
parameters:
a list
another list that contains the (one-based) indices of those elements that need to be kept in the first list
results in a filtered list
see also
@filter
and@filter-indices
This function filters the first list, and removes all elements for which the associated (one-based) index is not contained in the second list.
For example, @filter-by-indices(@list("alpha", "beta", "gamma"), @list(1, 3))
will result in @list("alpha", "gamma")
.
@get
first parameter: a list
second parameter: a whole number
see also:
@nth
Returns the element at the specified index within the (repeating) list.
Returns nil when the index is not found. (If you want to see an error-result instead, please use @nth
).
Examples:
@get(@list(100, 200, 300), 1)
will result in 100@get(@list(100, 200, 200), 55)
will result in nothing
Note that — unlike most programming languages — the index is one-based, i.e. the first index is one and 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-duplicate
parameter: a list
returns a new list in which each item is replaced by either true or false
see also:
@distinct
This function has a fairly advanced use case. It takes in a list of elements, and then returns a new list in which element is replaced by either true
or false
, depending on whether the element duplicates a previous element.
For example, @is-duplicate(@list("alpha", "beta", "gamma", "alpha"))
will return @list(false, false, false, true)
because element alpha is present twice in the list.
This function can be interesting in situations where you need to show a list that potentially contains duplicates, and you want to create a condition for removing those duplicates. For example, you may have a table that was completed by an end-user in the Q&A, and you want to avoid showing rows that happen to duplicate a previous row. See an example on our discussion forum.
@is-subset
parameters: two lists
returns true if the first list is a subset of the second list
This function returns true when all the elements of the first list are also present in the second list. Note that if the first set is empty, this will always return true.
For example, @is-subset(@list("alpha", "beta"), @list("alpha", "gamma", "beta", "delta"))
will return true
, while @is-subset(@list(5), @list(6, 7, 8))
will return false
.
Tip: you can easily invert the behaviour of this special function: not(@is-subset(@list("alpha", "beta"), @list("alpha", "gamma", "beta", "delta")))
returns false.
@for and @for-calc
parameters:
a placeholder
a list of elements (e.g., @list, list of texts datafield, or a repeating datafield)
a snippet that can optionally contain the specified placeholder, as well as the implicitly present placeholders ?INDEX and ?MAX-INDEX
results in a list of snippets (
@for
) or values (@for-calc
)
This function results in a list of snippets or values, equal to the number of elements specified in the second parameter. At each iteration, the snippet will be changed so that the specified placeholder will be replaced by element of the current iteration. In addition, the implicitly present placeholders ?INDEX
(= one-based index of the current iteration) and ?TOTAL
(= total number of elements) will also be replaced in the snippet.
For an in-depth discussion, see For-loops.
@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)
.
@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@intersection
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
@nth
first parameter: a list
second parameter: a whole number
see also:
@get
Returns the element at the specified index within the (repeating) list.
Returns an error when the index is not found. (If you want a null-value instead, please use @get).
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.
@numbered-paragraphs
parameters: either a list, or one or more values (which may themselves be lists, from which the elements will then be extracted)
inserts numbered paragraphs
see also:
@bullets
and@enumerate
Converts the parameter into numbered paragraphs. This is roughly equivalent to what the various @enumerate
functions do, but instead of bullets or inline-numbered paragraphs / texts, entire numbered paragraphs are being inserted.
As illustrated by the screenshot below, it is easiest to insert this special function at the start of a numbered paragraph; this way, it will take on the numbering of the former paragraph.
@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’.
@sum
parameter: a (repeating) list
returns the sum of all the numbers in the list
For example @sum(@list(1, 2, 3))
returns 6.
Last updated