Overview
This article explains how Fragment fields behave when used inside InfoSheet blocks.
It is a behavioural deep‑dive for Template Administrators who are already building complex InfoSheets and documents.
The article focuses on how OneLaw automatically scopes fragment data to the correct block instance during document assembly.
This article does not cover how to create fragments, blocks, or InfoSheets. Those workflows are documented separately and are assumed knowledge.
Who can do this
- System Administrators
- Template Administrators
Before you start
Before using fragments inside InfoSheet blocks, make sure you already understand how to:
- Create InfoSheets and attach them to Precedents
- Configure repeating, conditional, and nested blocks
- Use fragment fields in documents
- Assemble documents using Mail Merge syntax
If you are not familiar with these concepts, review the recommended articles listed at the end of this page before continuing.
How fragments behave inside blocks
When a Fragment field is placed inside an InfoSheet block, OneLaw automatically scopes the fragment to the correct block instance during document assembly.
This behaviour is built in and requires no additional configuration.
In effect:
- Each fragment execution is tied to a single block instance
- Only data from that instance is available to the fragment
- Data from other block instances is not accessible
This behaviour applies consistently to repeating, conditional, and nested blocks.
How fragments behave inside repeating blocks
Repeating blocks are the clearest way to see fragment scoping in action.
Example: fragment per repeating row
InfoSheet structure
- InfoSheet: Property Details (prefix: Property)
- Repeating block: Chattels
- Field: Name
- Field: Value
- Field: Clause (Fragment field)
User Input
- Chattel 1: Name = Refrigerator, Value = $500
- Chattel 2: Name = Washing Machine, Value = $600
- Chattel 3: Name = Dishwasher, Value = $400
What happens during assembly
- The fragment is executed once for each Chattels block instance
- Each execution receives only the Name and Value for that row
- The fragment cannot access data from other Chattels instances
This allows the same fragment to be reused while producing row‑specific output.
Using block syntax inside fragment documents
Fragment documents must use the same Mail Merge block syntax as the main document.
Even though only one block instance is processed at a time, full Start and End block markers are still required.
OneLaw automatically filters the data so that only the relevant instance is evaluated.
Reserved block properties in fragments
Fragments can use the same reserved block properties that are available in main documents, including:
- index - the position of the instance within the block (starting at 1)
- count - the total number of instances in the block
- is_first - true only for the first instance in the block
- is_last - true only for the last instance in the block
- separator - the resolved separator text for the instance, based on the block’s HasSeparator configuration
When used inside a fragment:
- These properties are evaluated relative to the current block instance
- Their values reflect the fragment’s position within the repeating block
No special handling is required.
Nested blocks with fragments
Fragments can be used inside nested block structures.
When blocks are nested:
- Block instance scoping is applied independently at each level
- The fragment only has access to data from the correct parent and child block instances
As long as the fragment document uses the correct nested Start and End block syntax, OneLaw handles filtering automatically.
Common pitfalls
Keep the following limitations in mind when using fragments inside blocks:
- Fragments cannot access data from sibling or unrelated block instances
- Missing or incorrect block Start or End markers will prevent correct scoping
If fragment output appears incomplete, the issue is usually related to block structure rather than fragment configuration.
Best practice guidance
When designing fragments for use inside InfoSheet blocks:
- Keep each fragment focused on a single block instance
- Always include full Start and End block markers in fragment documents
- Use reserved block properties for numbering or conditional output where needed
- Test fragments with multiple block instances to confirm behaviour
Result
When fragments are used inside InfoSheet blocks:
- Each fragment is automatically scoped to the correct block instance
- Repeating and nested blocks behave predictably without additional configuration
- Fragment output remains accurate even when blocks repeat multiple times