Parameters are a tool that can be used in ClauseBase grammar to make the use of snippets even more flexible. They function as a kind of placeholder.
Whereas snippets already enable you to replace a piece of text that is used multiple times across a clause or across several clauses/documents, combining snippets with parameters further upgrades the re-usability of a snippet by enabling you to replace the placeholder(s) in a snippet with different input each time you use the snippet.
How to use parameters
Insert the parameter as a placeholder in a snippet
Parameters are written starting with a question mark, followed by a name of your choice in all caps. For example:
?TYPE. Written as such, the parameter should be used in the (internal or external) snippet as a placeholder for input that can be chosen elsewhere (i.e. where the snippet itself is being referenced).
Give the parameter a value in the snippet reference
Without a value, the parameter in the snippet itself will give an error message (the name of the parameter surrounded with a purple background). So to be of any use, it should be assigned a value. That is done in the snippet reference.
The grammar for this is as follows: insert the snippet reference, followed by left parenthesis
(. Insert the name of the (first) parameter. To assign it a value, insert
:= followed by the relevant value. Multiple parameters can be assigned a value in one snippet reference by separating them with a comma. Close the reference off with right parenthesis
). The result looks like this:
- for an internal snippet:
@SNIPPET-REFERENCE(?PARAMETER1 := value1, ?PARAMETER2 := value2)
- for an external snippet:
@#snippet-reference(?PARAMETER1 := value1, ?PARAMETER2 := value2)
(The only difference between these references is the way internal and external snippets themselves are referenced)
Types of values
The parameter can get nearly any value that results in a piece of text. The most important limitations are that a parameter value itself cannot be (i) plain text or (ii) a condition (however, note that use of the
@if special function is allowed).
Examples of values:
- a concept reference
- a datafield
- a special function
An example of a very simple notice clause will illustrate this: