---
title: "Exercise 3 - Populating the JQL Queries"
canonical: "https://docs.getxporter.app/space/XPORTERCLOUD/461583/Exercise%203%20-%20Populating%20the%20JQL%20Queries"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

In this exercise, you'll learn how to export information from JQL Queries.

## Clause Parameter

- The syntax is similar to the other [Iterations](https://docs.getxporter.app/space/XPORTERCLOUD/428318), but there is a **[clause](https://confluence.atlassian.com/jiracorecloud/advanced-searching-765593707.html)**[ parameter that will receive the JQL Query](https://confluence.atlassian.com/jiracorecloud/advanced-searching-765593707.html).
- If the clause [JQL](https://docs.getxporter.app/space/XPORTERCLOUD/527003) is valid, it will be valid in the [Template](https://docs.getxporter.app/space/XPORTERCLOUD/427622).

# Populating the JQL Queries

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> The section between `#{for i=JQLIssuesCount|clause=<clause>}` and `#{end}` will grow dynamically according to the number of existing Issues respecting the clause.
> 
> > Macro (rw-step)
> 
> To begin iterating the JQL Issues with a clause, at the beginning of the Iteration section of your Template, put the mapping `#{for i=JQLIssuesCount|clause=project = ACADEMY}`, and at the end of that section, put the mapping `#{end}` to close it.
> 
> > ℹ️ In the example clause, we used `ACADEMY` because the name of our project is "ACADEMY"**. **Put the name of your project.
> > ℹ️ 
> > ℹ️ Also, you can use a placeholder on the clause (e.g.: #`{for i=JQLIssuesCount|clause=project = ``${ProjectKey}``}` ).
> 
> > Macro (rw-step)
> 
> Put `JQLIssues[i].` at the beginning of the mapping of the JQL Issues field you're populating. 
> 
> > ℹ️ Using the `JQLIssuesCount` mapping inside your iteration will return the count of issues that you have on the clause.
> > ℹ️ 
> > ℹ️ With the `JQLIssuesCount` iteration, you can populate the [fields](https://docs.getxporter.app/space/XPORTERCLOUD/558575/Mappings) that you have on the issue.
> 
> > Macro (rw-step)
> 
> When using the `#{for i=JQLIssuesCount|clause=project = ACADEMY}` statement, use one variable name like `i`. If you want to use a different variable name, like `a`, start your iteration with the statement `#{for a=JQLIssuesCount|clause=project = ACADEMY}` (make sure to change it properly on the`JQLIssues[a]. `at the beginning of the mapping of the Issue field you're trying to populate).
> 
> ```
> #{for i=JQLIssuesCount|clause=project = ACADEMY}
>    Key: ${JQLIssues[i].Key}
>    Summary: ${JQLIssues[i].Summary}
> #{end}
> 
> ```
> 
> > ℹ️ When defining an iteration for multiple columns of an [Excel template](https://docs.getxporter.app/space/XPORTERCLOUD/558471), you need to merge a row of columns and define the `#{for i=JQLIssuesCount|clause=project = ACADEMY}` inside the merged cells. The same thing should be done to define the `#{end}` of the same iteration.
> > ℹ️ 
> > ℹ️ All content between the `#{for i=JQLIssuesCount|clause=project = ACADEMY}` definition and the `#{end}` will be duplicated for each issue returned by the JQL clause.
> 
> ## Examples
> 
> Below (Figure 1) is a sample of how the [mappings](https://docs.getxporter.app/space/XPORTERCLOUD/558575) will be displayed in an Excel template.
> 
> ![Figure 1 - Excel template](media://0ec43b38-91d7-4fab-baa4-300e6eadc781)
> 
> This Template (Figure 1) has:
> 
> - A static section iteration (Figure 1 - 1).
> - Headings (Figure 1 - 2).
> - Text styling (Figure 1 - 2).
> 
> Below (Figure 2) there is a sample of how the generated file will be populated.
> 
> ![Figure 2 - Populated file](media://20b66054-9031-4864-b16f-758d0672abd1)


> ℹ️ **This exercise is now complete. Proceed to **[**Exercise 3**](https://docs.getxporter.app/space/XPORTERCLOUD/559729/Exercise+4+-+How+to+Populate+the+Comments+Inside+JQL+Queries)** to learn how to populate**** the comments inside JQL queries.**
> ℹ️ 
> ℹ️ If you like this exercise, please leave a comment or a 👍. Your feedback is very important to us.
> ℹ️ 
> ℹ️ Thank you in advance. Enjoy our product!

<details>
<summary>Exercise 3 Resources</summary>

| **File** | **Description** |
| --- | --- |
|  | **Exercise 3** - Sample template file |
|  | **Exercise 3** - Sample generated file |
</details>


<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>