# Bug in export of ORDINAL texts defined in templates

**URL:** https://discourse.openehr.org/t/bug-in-export-of-ordinal-texts-defined-in-templates/3670
**Category:** Archetype Designer
**Created:** [10 March 2023 17:51 UTC](https://discourse.openehr.org/t/bug-in-export-of-ordinal-texts-defined-in-templates/3670 "2023-03-10T17:51:33Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![erik.sundvall](https://discourse.openehr.org/user_avatar/discourse.openehr.org/erik.sundvall/32/1961_2.png) [@erik.sundvall](https://discourse.openehr.org/u/erik.sundvall)
#### Post date: [27 March 2023 00:33 UTC](https://discourse.openehr.org/t/bug-in-export-of-ordinal-texts-defined-in-templates/3670/3 "2023-03-27T00:33:06Z")

</div>

Hi!

I have tried but probably not completely succeded to understand the meaning and implications of @borut.fabjan’s response .

I made new tests with an enhanced test file with an extra repetition of the node B: (repeated node is marked BB:) see image below. The test file also has language translations (a proper one to Swedish and a bad incomplete one in German). The file and fileset are available in [https://github.com/regionstockholm/background\_and\_examples/tree/main/AE\_ORDINAL\_export\_bugs](https://github.com/regionstockholm/background_and_examples/tree/main/AE_ORDINAL_export_bugs)

**Please confirm/reject and possibly enlighten regarding the following assumptions:**

1. The native format of Archetype Designer (AD) handles and stores (even multilingual) specialisations of ORDINALs at template level. Yes?

2. Export of ORDINALs defined at template level is supported by AE for openEHR 1.4 **.OET** _template_ files. (A separate file export per translataion language needed.) The output will be in the by @borut.fabjan above described “1|one” format (hack) for the original language of the template, but does not work for translations (exported file shows the template’s original language in ORDINALs instead).

3. Export of ORDINALs defined at template level could become supported by AE for _Operational Templates_ **.OPT** (1.4) files (If you have repeated/redefined nodes, then a separate file export per translataion language is likely needed, and don’t forget [the l10n annotation trick](https://discourse.openehr.org/t/limitation-preventing-multilingual-repeated-parts-in-the-opt-operational-template-export-format/2760) for the repeated nodes.) If you select Swedish as primary language when exporing you get a file like [test 2 of ordinal selection defentition in template.sv.opt](https://github.com/regionstockholm/background_and_examples/blob/main/AE_ORDINAL_export_bugs/test%202%20of%20ordinal%20selection%20defentition%20in%20template.sv.opt)  
BUT there is currently a bug in AE OPT export code for term definitions of template level specialized ORDINALs (no matter if exporting in original language or translated language) so you have to patch the files (manually or via script) to include snippets like `<term_definitions code="at0.0.1"> < items id="text">mild B (sv)</items> < items id="description">B1</items> </term_definitions>`and then it works like a charm to import the  
manually patched test 2 of ordinal selection defentition in template.sv.opt to form building tools:  

4. Export of ORDINALs defined at template level could become supported by AE for _web templates_ (.json). The file format can support multilingual such support, but the export code is broken/missing and exported web templates likely need to be patched in adding both a missing “label” node and missing content of “localizedLabels” language specific sub nodes, see [diff of started (not yet completed) manual patch](https://github.com/regionstockholm/background_and_examples/commit/3686761ca01f64967be82a6c939a2053a97d58a3) to get a hint of the likely pattern (this has not been tested by importing to tools yet).

---

_[View the full topic](https://discourse.openehr.org/t/bug-in-export-of-ordinal-texts-defined-in-templates/3670)._
