Hide a line if an element is empty
When creating a template, some value may be optional and it creates an empty line the generated document.
It is possible to remove a line based on condition, here is an example using the following JSON dataset:
{
"firstname": "John",
"lastname": "Wick",
"address1": "221B Baker Street",
"address2": "",
"city": "London"
}
An ODT template is create and it is printing all of the information above, except the address2 if empty, such as:

In order to hide the line, the expression {d.address2:ifEM:hideBegin} is placed just before the value and the {d.address2:hideEnd} just after the break-line.
Here is the result:

To hide the address1 and city if values are empty, it is possible to add expression, such as:

When using conditional blocks, we recommend to use only break-lines shift + enter, learn more on the following article
When creating a template, some value may be optional and it creates an empty line the generated document.
It is possible to remove a line based on condition, here is an example using the following JSON dataset:
{
"firstname": "John",
"lastname": "Wick",
"address1": "221B Baker Street",
"address2": "",
"city": "London"
}
An ODT template is create and it is printing all of the information above, except the address2 if empty, such as:

In order to hide the line, the expression {d.address2:ifEM:hideBegin} is placed just before the value and the {d.address2:hideEnd} just after the break-line.
Here is the result:

To hide the address1 and city if values are empty, it is possible to add expression, such as:

When using conditional blocks, we recommend to use only break-lines shift + enter, learn more on the following article
Updated on: 02 / 15 / 2022