---
title: "Exercise 7 - Populating Details of Images"
canonical: "https://docs.getxporter.app/space/XPORTERCLOUD/559560/Exercise%207%20-%20Populating%20Details%20of%20Images"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

In this exercise, you'll learn how to export details of images.

We will use the notation that enables you to define which sections of the template will be populated for each Issue, and which sections will remain static: `&{for issues}`

# Populating Details of Images

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Use a [Conditional Block](https://docs.getxporter.app/space/XPORTERCLOUD/527146) `#{if...}` to determine whether to iterate or not.
> 
> > Macro (rw-step)
> 
> Insert the [mapping](https://docs.getxporter.app/space/XPORTERCLOUD/558575) `${Key}` to indicate the Issues being populated. 
> 
> > Macro (rw-step)
> 
> If the Issue **lacks images**, display a message instead.
> 
> ```
> #{if (%{'${ImagesCount}' == 0})}
> Doesn't have Images.
> #{end}
> ```
> 
> If the Issue **contains images**, set the message to display the number of images, along with the image [Iteration](https://docs.getxporter.app/space/XPORTERCLOUD/428318).
> 
> ```
> #{if (%{'${ImagesCount}' > 0})}
> There are ${ImagesCount} images.
> ```
> 
> > Macro (rw-step)
> 
> In this scenario, the mapping #{end} remains open <span style="color: #0d0d0d">as we'll conduct an Iteration before closing the Conditional Block.</span>
> 
> > Macro (rw-step)
> 
> Below it, include the `#{for images}` or the `#{for <VariableName>=ImagesCount}` statement.
> 
> > Macro (rw-step)
> 
> Use the mapping to display an image with max width and max height: `${Images[n].Image|maxwidth=100|maxheight=100}`
> 
> > ℹ️ You can customize the maxwidth and the maxheight.
> 
> > Macro (rw-step)
> 
> Create a table to populate the image details:
> 
> | **Name** | ${Images[n].Name} |
> | --- | --- |
> | **HumanReadableSize** | ${Images[n].HumanReadableSize} |
> | **CreatedDateTime** | ${dateformat("dd-MM-yyyy HH:mm:ss")Images[n].Created} |
> | **MimeType** | ${Images[n].MimeType} |
> 
> 
> > ℹ️ [List of fields](https://docs.getxporter.app/space/XPORTERCLOUD/428318/Iterations) to be populated when iterating images.
> 
> > Macro (rw-step)
> 
> Close the two statements using the mapping `#{end}`
> 
> > Macro (rw-step)
> 
> <span style="color: #0d0d0d">Optionally, you can implement a conditional block to print specific images. </span><span style="color: #0d0d0d">Conduct another iteration of</span> `#{for images}` or `#{for <VariableName>=ImagesCount}` statement.
> 
> > Macro (rw-step)
> 
> Below it, use a Conditional Block: `#{if (%{"${Images[n].Name}".equals("xporter.png")})}`
> 
> > Macro (rw-step)
> 
> > ℹ️ If the conditional block is true, proceed accordingly.
> > ℹ️ 
> > ℹ️ In this example, we attached an image named *xporter.png*. Ensure you attach images to your issue.
> 
> > Macro (rw-step)
> 
> Utilize the mapping to display an image with maxwidth and maxheight: `${Images[n].Image|maxwidth=100|maxheight=100}`
> 
> > Macro (rw-step)
> 
> Close the two statements using the mapping `#{end}`
> 
> > Macro (rw-step)
> 
> Conclude the `&{for issues}` opened at the beginning using the mapping `&{end}`
> 
> ## Examples
> 
> Below (Figure 1) is a sample of how the mappings will be displayed in a Word template.
> 
> ![Figure 1 - Word template](media://b33887a0-8e6b-449b-955a-fc3344ac8dbc)
> 
> This Template (Figure 1) include:
> 
> - A header with a logo (Figure 1 - 1).
> - Headings (Figure 1 - 2).
> - Text styling (Figure 1 - 4)
> - Table (Figure 1 - 3).
> 
> Below (Figure 2) is a sample of how the generated file will be populated:
> 
> ![Figure 2 - Populated file](media://29751c81-6e69-4f3d-8950-b70a54e334e9)


> ℹ️ **Congratulations, you passed the **[**Intermediate level**](https://docs.getxporter.app/space/XPORTERCLOUD/428075)**! Proceed to the next level - **[**Level 3 (Advanced)**](https://docs.getxporter.app/space/XPORTERCLOUD/526295)**.**
> ℹ️ 
> ℹ️ 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 7 Resources</summary>

| **File** | **Description** |
| --- | --- |
|  | Exercise 7 - Sample Template file |
|  | Exercise 7 - 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>