Multi-select Choice fields can be used as more than a way of inserting several selected answers into a contract. When processed as a collection, they allow the template to understand:
how many values were selected;
which value is currently being processed; and
where that value sits within the overall list.
This enables useful drafting patterns such as natural-language lists, dynamic numbering, position-based wording, repeated drafting, and special treatment of individual selections.
The Three Key Expressions
1. MULTISELECT_FIELD.length — How many items were selected
For example, if three options are selected:
Option A
Option C
Option F
then:
MULTISELECT_FIELD.length = 3
The useful point here is that the template can determine how many selections exist without needing to know what those selections actually are.
This can be used anywhere the drafting depends on quantity rather than the specific answers selected.
2. $index — Which item am I processing?
When the multi-select is being processed, $index identifies the position of the current item.
Indexes start at zero:
First item = 0
Second item = 1
Third item = 2
Because of this, the last item in a collection can be identified using: $index == MULTISELECT_FIELD.length - 1
For example, if four items are selected, the length is 4 but indexes are 0, 1, 2 and 3.
3. MULTISELECT_FIELD[$index] — What is the current value?
MULTISELECT_FIELD[$index] returns the actual value currently being processed.
For example:
[0] Option A
[1] Option C
[2] Option F
If $index = 1, then:
MULTISELECT_FIELD[$index]
returns:
Option C
This makes it possible to apply logic to each individual selected answer while the template works through the collection.
Use Case 1: Natural-Language Lists
One of the clearest uses of this functionality is converting a multi-select response into normal contractual prose.
The template can automatically produce:
Option A
Option A and Option B
Option A, Option B and Option C
Option A, Option B, Option C and Option D
The punctuation can be controlled entirely by the position of each selected value.
Adding commas between middle items
{#$index > 0 && $index < MULTISELECT_FIELD.length - 1}, {/}
This means:
If the current item is not the first item and is not the final item, insert a comma before it.
Adding “and” before the final item
{#$index > 0 && $index == MULTISELECT_FIELD.length - 1} and {/}
This means:
If the current item is the final item, and there was at least one item before it, insert “and” before it.
The actual selected value can then be inserted using:
{MULTISELECT_FIELD[$index]}
This creates a natural-language list without having to code every possible combination of selections.
Use Case 2: Dynamic Numbering
The same functionality can be used for dynamic numbering or position-based drafting.
Because $index tells us which item is currently being processed:
$index = 0 → first item
$index = 1 → second item
$index = 2 → third item
This can support scenarios where each selection needs to generate its own:
numbered entry;
subparagraph;
schedule item;
repeated clause; or
position-specific piece of drafting.
The key advantage is that the template does not need to know in advance which options were selected. It can respond to how many items exist and where the current item sits within the collection.
Why This Is Useful
The major benefit is that the template can reason about the collection itself rather than having to account for every possible combination of answers.
For a multi-select with many options, manually coding every possible combination quickly becomes unmanageable.
Using:
.length → how many selections are there
$index → where am I in the list
[$index] → what is the current selection allows the drafting to adapt dynamically.
Potential applications include:
natural-language lists;
dynamic numbering;
repeated clauses;
schedules;
lists of services or jurisdictions;
position-specific drafting;
singular/plural behaviour; and
special treatment of options such as Other.
Implementation Considerations
Indexes start at zero.
The final item is therefore always:
MULTISELECT_FIELD.length - 1
not simply MULTISELECT_FIELD.length.
Use the current item for option-specific logic.
Where one particular selection needs different drafting, test:
MULTISELECT_FIELD[$index]
rather than the overall multi-select field.
Key Takeaway
The core functionality is:
MULTISELECT_FIELD.length
How many values were selected?
$index
Which selected value am I currently processing?
MULTISELECT_FIELD[$index]
What is the value of that selection?
Together, these make multi-select fields significantly more powerful than simple output fields. They allow templates to dynamically control list formatting, numbering, repeated drafting, position-based logic and individual selected values without having to manually map every possible combination.
