# Relatorio: choose, when, and others

**URL:** https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703
**Category:** Developer
**Tags:** relatorio
**Created:** [October 14, 2021, 10:48am UTC](https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703 "2021-10-14T10:48:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![DomCa](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/da6949/32.png) [@DomCa](https://discuss.tryton.org/u/DomCa)
#### Post date: [October 14, 2021, 10:48am UTC](https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703/1 "2021-10-14T10:48:06Z")

</div>

Hi all,

I just started looking into relatorio and I read in the documentation:

> In this example, we only used the py:for directive, but Relatorio also supports other Genshi directives: py:if, py:choose / py:when / py:otherwise and py:with.

However, I cannot get a choose - when clause into my odt document.

I tried adding fields (Ctrl+F2) comprising  
\<choose=“”\>  
\<when=“o.total \<= 100”\>  
\<when=“o.total \> 100”\>

I also tried with closing tags. With the above, I get the error:

> TypeError: escape\_xml\_invalid\_chars() got an unexpected keyword argument ‘choose’

Could anybody please give an example? Or is this not supported?

Thank you!  
Dom Ca

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 14, 2021, 11:07am UTC](https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703/2 "2021-10-14T11:07:41Z")

</div>

> [@DomCa](#):
>
> \<when=“o.total \<= 100”\>  
> \<when=“o.total \> 100”\>

It should be:

```auto
<choose>
<when test="o.total <= 100">
</when>
<when test="o.total > 100">
</when>
</choose>

```

or even better:

```auto
<choose>
<when test="o.total <= 100">
</when>
<otherwise>
</otherwise>
</choose>

```

---

<div class="post-metadata">

### Author: ![DomCa](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/da6949/32.png) [@DomCa](https://discuss.tryton.org/u/DomCa)
#### Post date: [October 14, 2021, 11:21am UTC](https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703/3 "2021-10-14T11:21:21Z")

</div>

Hi Cedric,

Thank you!

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [November 13, 2021, 11:21am UTC](https://discuss.tryton.org/t/relatorio-choose-when-and-others/4703/4 "2021-11-13T11:21:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
