LogoLogo
ClausesDatafieldsSpecial FunctionsStylingQ&AAPI
  • Welcome!
  • Getting started
    • What is Clause9?
    • Structuring your clause library
    • Structuring your clauses
    • Drafting modes in Clause9
    • Creating a questionnaire
    • Sample clauses
    • Videos
      • Concepts and datafields
      • Conditions
      • Q&As
      • Binders
      • Styling
      • Enumerations
      • Tables
      • Definitions
      • Snippets
      • Cross-references
      • Special functions
      • Examples of common clauses
      • Import clauses from MS Word
      • Grammatical conjugations
      • Action buttons
      • Alternative clauses
  • Assemble document
    • Document toolbar
    • Clause hierarchies
    • Focus Mode
    • Bulk generation of documents
    • Exporting documents
    • Assemble Document - FAQ
    • How to: Assemble Document
      • Insert images
  • Assemble Document Operations Panel
    • Operations panel
    • File pane
    • Edit pane
    • Document pane
    • Binder pane in the operations panel
    • Search pane
    • Browse pane
    • Terms pane
    • Data dashboard
    • Advanced pane
    • Styling pane
    • Miscellaneous pane
    • Visibility settings & actions menu
  • Binders
    • Binders: general
    • Styling cross-references to subdocuments
    • Global and local definition lists
    • Document and binder properties
    • Styling of a Binder versus subdocuments
    • (Un)locking documents in a binder
    • Binders - FAQ
    • How to: binders
      • Make a subdocument in a binder conditional
  • Clauses
    • Introduction to clauses
    • Clause structure
    • Grammar sheet
    • Writing conditions
    • Examples of conditions
    • Using codes instead of text fragments
    • Bold, italic and underline
    • Special codes
    • Enabled?
    • Links
    • Cross-references
    • Introduction to tables
    • Deviating table styling
    • Shrinking clauses
    • Action buttons
    • Enumerations
    • File position
    • Snippets
    • Parameters
    • Conjugations
    • Mixing data types
    • For-loops
    • Clause versioning
    • Abstract article references
    • Advanced multi-language features
    • Clauses - FAQ
    • How to: clauses
      • Create an ad-hoc clause
      • Create a library clause
      • Make a clause repeat
      • Make a paragraph within a clause conditional
      • Use a shortcut to refer to a concept
      • Insert a line break or page break
      • Creating a list with both predefined options and free input
      • Defining alternative clauses
      • Creating cross-references
      • Creating signature blocks
      • Creating advanced party introduction clauses
      • Automatically numbered annexes or schedules
      • Reuse any clause in a different context
      • Setting MS Word document properties
      • Add action buttons to clauses
      • Electronically signing documents
  • concepts
    • Introduction to concepts
    • Creating concepts
    • Concept labels
    • Links
    • Organising concepts
    • Concepts - FAQ
    • How to: concepts
      • Add predefines to a datafield
  • Datafields
    • Introduction to datafields
    • Types of datafields
    • Rules of thumb for using datafields
    • Data-expressions
    • Datafield aliases
    • Datafield labels
    • Datafield special tags
    • Datafield descriptions
    • Repeating list datafields
    • Datafield predefines
    • Datafields - FAQ
    • How to: datafields
      • Change datafield type
      • Change the datafield's name or alias
  • Definitions
    • Introduction to definitions
    • How to: definitions
      • How do definitions work?
      • Create a definition
  • Files
    • How files are organised
    • Browse files
    • File types
    • Custom styling
    • Legal comments
    • File description
    • Attributes
    • Reporting
    • File name
    • File category
    • Access rights
    • How to: files
      • Creating advanced folders
      • Naming your files
      • Shortcuts to folders or files
  • Q&A
    • About cards
    • Cards pane
    • About changes
    • Changes pane
    • Types of changes
    • Adding conditions
    • Question options
    • Copying & pasting answers
    • Comments, notes & documentation
    • Interactive Q&A inspection
    • Embedding questions into a document
    • “Changes” button
    • Batch create pane
    • Identifiers pane
    • Import pane
    • Edit clauses pane
    • Q&A options
    • Q&A - FAQ
    • How to: Q&A
      • Create predefined answers to a question
      • Add disclaimers
      • Create categories of questions
      • Modify the exported filename
      • Create a question to change the language of a document
      • Send a questionnaire to someone without a ClauseBase account
      • Create questions for repeating list datafields
      • Selecting legal entities & addresses
      • Create a questionnaire using "batch create"
      • Launch other Q&As
    • Leveraging ClauseBuddy Smart Templates in Clause9
  • Import
    • Introduction to importing clauses
    • Uploading clauses
    • Defined terms in Import mode
    • Datafields in Import mode
    • Cross-references in Import mode
    • Assigning folders
    • Conversion process
    • Exporting
    • Stashing intermediate results
    • Tips, tricks & limitations
  • Styling
    • Styling overview
    • Base styling
    • Numbering
    • Definitions styling
    • Enumerations styling
    • Locale styling
    • References styling
    • Page styling
    • Styling of a Binder versus subdocuments
    • Styling: tips and tricks
    • Advanced styling topics
    • Copying headers and footers from an MS Word file
    • How to: styling
      • Using custom fonts
      • Change bullet styling
  • Special functions
    • Introduction
    • Calculations
    • Concepts
    • Conditions
    • Conjugations
    • Content Control Elements
    • Datafields
    • Dates & durations
    • Languages
    • Lists
    • Numbers
    • References
    • Repeating (looping)
    • Special items
    • Text structure
    • Text modification
    • User
    • Q&A
  • Settings
    • Account
    • Preferences
    • Access bundles
    • Favourites
    • Saved searches
    • Saved datafields
    • Styles
    • Default styles
  • Admin
    • General
    • Users
    • User rights
    • Profiles
    • Groups
    • Styles
    • Default styles
    • Attribute models
    • Usage page
    • Custom homepage
    • Global placeholders
    • Access rights
    • How to: admin
      • Adding a new user
      • Disabling a user
      • Managing group memberships
  • Miscellaneous
    • Advanced tips & tricks
    • Typing special symbols on your keyboard
    • Shortcuts
    • Grammar style guide
    • Inserting MS Word files
    • Globo-panel
    • Creating high-quality documents
    • Excel calculations and lookups
  • Integrations
    • Overview
    • Spreadbases
    • E-signing documents
    • Drag & drop integrations
  • For developers
    • Clause9 API
    • Custom functions
    • Example custom functions
Powered by GitBook
On this page
  • @bullets
  • @count
  • @difference
  • @distinct
  • @empty-list
  • @enumerate
  • @filter
  • @filter-indices
  • @filter-by-indices
  • @get
  • @intersection
  • @is-duplicate
  • @is-subset
  • @is-unique
  • @for and @for-calc
  • @list-if-all
  • @union
  • @nth
  • @numbered-paragraphs
  • @sort
  • @sum
Export as PDF
  1. Special functions

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 and @is-unique

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. This kind of is the opposite of what @is-unique conveys, although there's a subtle difference (see below).

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.

@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.

@is-unique

  • parameter: a list

  • returns a new list in which each item is replaced by either true or false

  • see also: @is-duplicate

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 there is any other element in the list that is equal (false) or whether instead the element considered is unique (true) .

This is kind of the opposite of what @is-duplicate does, but not entirely, because @is-duplicate only produces true as from the second instance of an element, i.e. it produces false for the first instance of a duplicate element in the list.

For example, @is-unique(@list("alpha", "beta", "gamma", "alpha")) will return @list(false, true, true, false) because element alpha is present twice in the list.

@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.

@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.

PreviousLanguagesNextNumbers

Last updated 1 month ago

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 .

For an in-depth discussion, see .

discussion forum
For-loops
Note that the #content^paragraphs happens to be a list of text, with elements “aaa”, “bbb” and “ccc”.