Embedded Resources in Templates
A template usually stores line items as references — a line says "labourer hourly rate" by name, and when applied, TX1 tries to match a resource in the current project. Embedded resources bundle the actual resource record (and its built-up breakdowns) inside the template, guaranteeing fidelity.
When to Embed
- When a template depends on resources your organisation's other projects may not have.
- When the resources have specific rates you want to land untouched.
- When you want to port the template to a different organisation or a sharing partner.
What Gets Stored
Field on TemplateEmbeddedResource | Purpose |
|---|---|
ResourceDataJson | Full ResourceDto serialised. |
BreakdownsJson | List of BuiltUpBreakdownDto — for built-up resources. |
ResourceName | Denormalised for search. |
ResourceType | Denormalised. |
IsBuiltUp | True if the resource has a built-up breakdown. |
DirectRate | Snapshot of rate at time of save. |
BreakdownCount | For UI preview. |
IsComponent | Built-up components are tagged so they import first. |
ImportOrder | Controls dependency ordering on apply. |
OriginalResourceId | For provenance / debugging. |
SourceProjectId | Where the resource came from. |
Creating a Template with Embedded Resources
- Select items using the resources you want to embed.
- Save as Template.
- Tick Embed Resources.
- TX1 walks the items, collects referenced resources (including component resources of built-ups), and bundles them.
Component resources are detected recursively — a built-up "Formwork Package" that depends on "Timber", "Labour" and "Nails" will embed all four.
Applying a Template with Embedded Resources
On Apply you get a conflict dialog:
| Option | Behaviour |
|---|---|
| Skip existing | Don't create resources that already exist with the same name. Link to them instead. |
| Rename | Create fresh resources with a suffix (e.g. " (from template)"). |
| Overwrite | Replace existing resource data with the template's snapshot. Warning — this can break unrelated projects. |
| Fail on conflict | Cancel the apply if any conflict is detected. |
Default is Skip existing.
Dependency Resolution
Embedded resources import in ImportOrder to ensure components exist before the built-ups that depend on them. You never need to think about this manually.
Preview
PreviewTemplateResourceImportAsync returns:
- List of resources that would be created.
- List that would be skipped (already exist).
- List that have a name clash.
- Warnings.
Embedding Later
You can embed resources into an existing template: Templates → Embed Resources. Useful when a template was created early without embedding, and you now want to share it externally.
Limitations
- Embedded resources can bloat a template's storage. A template with hundreds of resources is uncommon; consider splitting.
- Embedded resources are snapshots — updates to the source resource do not flow into the template. Re-embed if you need fresh data.