# How to export templates in opt or xml formate

**URL:** https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131
**Category:** Archetype Designer
**Created:** [2 December 2020 02:57 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131 "2020-12-02T02:57:10Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![YogeshSomawar](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yogeshsomawar/32/778_2.png) [@YogeshSomawar](https://discourse.openehr.org/u/YogeshSomawar)
#### Post date: [2 December 2020 02:57 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/1 "2020-12-02T02:57:10Z")

</div>

Hi,

I am new to openEHR system. We are using archetype designer for our research. I have created some template using “[https://tools.openehr.org/designer](https://tools.openehr.org/designer)”. I would like to export these template in XML or OPT format, so that I can use these templates at “[https://toolkit.cabolabs.com/app/free\_tools](https://toolkit.cabolabs.com/app/free_tools)”.  
I can see opt format option available, but it is giving message like “Cannot export embedded template to OPT.”

Could you please help me with exporting template in opt or xml formate?

Regards.  
–Yogesh

---

<div class="post-metadata">

### Author: ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)
#### Post date: [2 December 2020 04:28 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/2 "2020-12-02T04:28:11Z")

</div>

Hi,  
The archetype designer has a very straightforward export option that allows you to export your template to OPT. Once you have opened a template, you can click on the export menu on the top bar. In the pop up you can click on the export button to get a dropdown of the available options. When you select any option in the drop down list, you get an option to save what you have exported.

I have attached a screenshot for your reference  
regards

 ![designer.png](https://discourse.openehr.org/uploads/default/original/1X/2efa959963cbf86a1e22c87ec0917e6b175f1161.png)

---

<div class="post-metadata">

### Author: ![YogeshSomawar](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yogeshsomawar/32/778_2.png) [@YogeshSomawar](https://discourse.openehr.org/u/YogeshSomawar)
#### Post date: [2 December 2020 07:05 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/3 "2020-12-02T07:05:02Z")

</div>

Thanks @Dileep_V_S, I saw that option, but it is giving error like " Cannot export embedded template to OPT".  
Also, do yo know, can you help me with exporting template in XML as well.

---

<div class="post-metadata">

### Author: ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)
#### Post date: [2 December 2020 07:37 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/4 "2020-12-02T07:37:06Z")

</div>

Hi,  
Not sure what that error means. If you can share the template files, I can take a look.

As for exporting to XML, OPT is XML

regards

---

<div class="post-metadata">

### Author: ![YogeshSomawar](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yogeshsomawar/32/778_2.png) [@YogeshSomawar](https://discourse.openehr.org/u/YogeshSomawar)
#### Post date: [2 December 2020 11:00 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/5 "2020-12-02T11:00:17Z")

</div>

Hi @Dileep_V_S,

I am creating a template here itself “[https://tools.openehr.org/designer](https://tools.openehr.org/designer)”. I exported it in native format(JSON). Please see if you can export that in opt file.

~Yogesh  
This text will be hidden

[bp\_temp.t.json](https://discourse.openehr.org/uploads/short-url/sozBhfm0CKQSwPCJx6NFnNU3KQL.json) (3.07 KB)

---

<div class="post-metadata">

### Author: ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)
#### Post date: [2 December 2020 13:11 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/6 "2020-12-02T13:11:32Z")

</div>

Hi Yogesh,

The problem here is that you are creating a template based on an ENTRY archetype - specifically and OBSERVATION. You can only create operational templates on Composition-based templates as these are whatare used to validate the composition instances that are stored in the openEHR CDRs. All openEHR data must be commited as part of a composition.

What you have created is what we would call an embedded template - it is a fragment that can be pre-constrained and then shared between multiple composition templates.

THe best next step is just to create a new Composition-based template then add your blood pressure embedded template into it under content. You should see it along with the list of applicable archetypes. THen export the composition .opt -\> it will include your embedded template fragment.

---

<div class="post-metadata">

### Author: ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)
#### Post date: [2 December 2020 17:14 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/7 "2020-12-02T17:14:06Z")

</div>

> [@ian.mcnicoll](#):
>
> The problem here is that you are creating a template based on an ENTRY archetype - specifically and OBSERVATION.

Adding to that, [toolkit.cabolabs.com](http://toolkit.cabolabs.com) only accepts OPTs for COMPOSITIONs.

---

<div class="post-metadata">

### Author: ![YogeshSomawar](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yogeshsomawar/32/778_2.png) [@YogeshSomawar](https://discourse.openehr.org/u/YogeshSomawar)
#### Post date: [3 December 2020 07:10 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/8 "2020-12-03T07:10:06Z")

</div>

Hi @ian.mcnicoll,

Thank you very much for the inputs. I am able to export the composition based template in OPT format !!!  
I am new to this system, Could you please point me the documentation where I can get details of terminologies like composition, observation, evaluations .

Regards

---

<div class="post-metadata">

### Author: ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)
#### Post date: [3 December 2020 09:22 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/9 "2020-12-03T09:22:19Z")

</div>

Hi,  
A good place to start will be this [https://specifications.openehr.org/releases/RM/latest/ehr.html](https://specifications.openehr.org/releases/RM/latest/ehr.html). You can also look at the related documents mentioned

regards

---

<div class="post-metadata">

### Author: ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)
#### Post date: [3 December 2020 09:28 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/10 "2020-12-03T09:28:26Z")

</div>

We have published a bunch of training presentations at [https://freshehr.com/resources/](https://freshehr.com/resources/) that you might find helpful. They are a wee bit out of date but most of it still applies.

# Presentations

[Introduction to 2-day workshop](https://www.slideshare.net/freshehr/1-0-intro-2-day-workshop-110659840)

[Anatomy of an eHealth app](https://www.slideshare.net/freshehr/1-1-anatomy-of-an-app-110660450)

[Why is eHealth so hard?](https://www.slideshare.net/freshehr/1-2-why-is-ehealth-so-hard-110660661)

[What is openEHR](https://www.slideshare.net/freshehr/1-3-introduction-to-openehr-110660910)

[Introduction to Archetypes and Templates](https://www.slideshare.net/freshehr/1-4-intro-to-archetypes-and-templates-110661079)

[Interoperability: Managing Healthcare Diversity](https://www.slideshare.net/freshehr/1-6-managing-healthcare-diversity-110661413)

[openEHR in context: integration, terminology and querying](https://www.slideshare.net/freshehr/1-7-openehr-in-context-110661577)

[openEHR Templates in detail](https://www.slideshare.net/freshehr/2-1-openehr-templates-in-detail-110661738)

[openEHR Archetypes: Classes Overview](https://www.slideshare.net/freshehr/2-2-openehr-archetypes-classes-110661989)

[openEHR Archetypes: Observations](https://www.slideshare.net/freshehr/2-3-openehr-archetypes-observation-110662107)

[openEHR Archetypes: Clusters](https://www.slideshare.net/freshehr/2-4-openehr-archetypes-cluster-110662250)

[openEHR Archetypes: Specialisations](https://www.slideshare.net/freshehr/2-5-openehr-archetypes-specialisation-110662355)

[openEHR Archetypes: Instructions and Actions](https://www.slideshare.net/freshehr/2-6-openehr-archetypes-instructionsactions-110662482)

[Introduction to the openEHR Reference Model](https://www.slideshare.net/freshehr/2-7-openehr-rm-reference-model-overview-110662624)

---

<div class="post-metadata">

### Author: ![YogeshSomawar](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yogeshsomawar/32/778_2.png) [@YogeshSomawar](https://discourse.openehr.org/u/YogeshSomawar)
#### Post date: [3 December 2020 10:00 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/11 "2020-12-03T10:00:50Z")

</div>

Thank You @ian.mcnicoll @Dileep_V_S for your help.

---

<div class="post-metadata">

### Author: ![Maurice247](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@Maurice247](https://discourse.openehr.org/u/Maurice247)
#### Post date: [4 August 2023 11:41 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/12 "2023-08-04T11:41:42Z")

</div>

@ian.mcnicoll I have similar error like @YogeshSomawar and tried your proposed solution to embed the template in a composition. However when embedding the template is empty, see screenshot attached. I would be grateful for your advice. Thank you!

 ![Screenshot 2023-08-04 at 13.37.01](https://discourse.openehr.org/uploads/default/original/2X/a/a2397557f7ed573321c315a37dc18aafbbd16348.jpeg)

---

<div class="post-metadata">

### Author: ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)
#### Post date: [4 August 2023 11:45 UTC](https://discourse.openehr.org/t/how-to-export-templates-in-opt-or-xml-formate/1131/13 "2023-08-04T11:45:49Z")

</div>

It is not actually empty - this is just the way that AD displays an embedded template - if you create the .opt or other downstream artefacts you will see all the datapoints from the embedded template are included.

If you e=want you can ‘inline’ the contents of the embedded template by pressing the yellow inline button, which will fold the contents of the embedded template into the parent, and they will become visible. Of course this will also then make the contents editable - some people use embedded templates exactly to prevent further editing.
