---
title: "Conditional Blocks"
canonical: "https://docs.getxporter.app/space/XPORTERCLOUD/527146/Conditional%20Blocks"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

## Introduction

<span style="color: #0d0d0d">Conditional blocks allow you to show or hide sections of the document based on conditional expressions. </span>

<span style="color: #0d0d0d">They follow this notation:</span>

`#{if (%{<Javascript>})} CONTENT #{end}`

[<Javascript>](https://docsxporter.atlassian.net/wiki/spaces/XPORTERCLOUD/pages/460547) is a JavaScript expression that should be evaluated as "true" or "false".

Below is a working example:

```
This is the header of the document. 

#{if (%{'${IssueTypeName}'.equals('Bug')})}
This section will only be visible if the issue type of the issue is Bug
This issue is a bug created by ${AssigneeUserName} with priority ${Priority}.
#{end}

#{if (%{'${Priority}'.equals('Major')})}
This section will only be visible if the priority of the issue is major.
This issue has top priority, needs to be resolved until ${DueDate}.
#{end}

#{if (%{'${escape:Description}'.equals('')})}
This issue has no description
#{end}

#{if (%{'${escape:Description}'.length > 0})}
Issue description: ${Description}
#{end}

This is the footer of the document.  
```

## More Examples

The *Sample Conditions.docx* template in the [Xporter Template Store](https://store.getxporter.app/view/20?platf=JIRACLOUD&sort=1&order=desc&keyWord=conditions).

### Word Template (Figure 1)

![image](media://aaa0ea44-8e64-48ce-b208-625d38d358b4)

### Excel Template (Figure 2)

![image](media://c6c30032-b96e-44fb-b574-f69ef64467cb)

<details>
<summary>Support/Troubleshooting</summary>

If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://docs.getxporter.app/space/XPORTERCLOUD/18251779/In-App+Chat+Support).
</details>