<p>I got it to work with this code:</p>

<pre><code>{% for entry in entries %}

    {% set myArray = [entry.title] %}

    {% for block in entry.myMatrixField %}

        {% set myArray = myArray|merge([block.field1,block.field2,block.field3]) %}  

    {% endfor %}

    {% do craft.sproutReports.addRow(myArray) %}

{% endfor %}
</code></pre>

CC BY-SA 4.0
2019-05-07T22:53:07.057Z
2019-05-07T22:53:07.057Z
SoHo
<p>Try the below code</p>

<pre><code>{% for block in entry.myMatrixField %}
  {% if block.type == "sproutReports" %}
    &lt;blockquote class="sproutReports{{ loop.index }}"&gt;
      &lt;p&gt;{{ block.sproutReports}}&lt;/p&gt;
    &lt;/blockquote&gt;
  {% endif %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2019-05-07T22:41:14.680Z
My question was specific to Sprout Reports plugin.
SoHo
CC BY-SA 4.0
2019-05-07T22:38:42.620Z
2019-05-07T22:38:42.620Z
Priti Rathod
<p>I'm not clear on how I would iterate over a Matrix field to be able to include the content in the row.</p>

<p>Wish there was an example in the docs: <a href="https://sprout.barrelstrengthdesign.com/docs/reports/custom-twig-template-report.html#template-settings" rel="nofollow noreferrer">https://sprout.barrelstrengthdesign.com/docs/reports/custom-twig-template-report.html#template-settings</a></p>

<pre><code>{% for entry in entries %}

    {% do craft.sproutReports.addRow([
      entry.title, 
      entry.myMatrixField
    ]) %}

{% endfor %}
</code></pre>

<craft3><matrix><plugins><plugin-sproutreports>
Sprout Reports plugin - How to output a Matrix field into a row
# Sprout Reports plugin - How to output a Matrix field into a row

(Asked by: username_0 on 2019-05-07)

I'm not clear on how I would iterate over a Matrix field to be able to include the content in the row.
Wish there was an example in the docs: https://sprout.barrelstrengthdesign.com/docs/reports/custom-twig-template-report.html#template-settings
{% for entry in entries %}

    {% do craft.sproutReports.addRow([
      entry.title, 
      entry.myMatrixField
    ]) %}

{% endfor %}

**Tags:** craft3, matrix, plugins, plugin-sproutreports

---

## 2 answers

### Answer by username_0 on 2019-05-07. Score: 2 | Accepted answer

I got it to work with this code:
{% for entry in entries %}

    {% set myArray = [entry.title] %}

    {% for block in entry.myMatrixField %}

        {% set myArray = myArray|merge([block.field1,block.field2,block.field3]) %}  

    {% endfor %}

    {% do craft.sproutReports.addRow(myArray) %}

{% endfor %}


---

### Answer by username_1 on 2019-05-07. Score: -1

Try the below code
{% for block in entry.myMatrixField %}
  {% if block.type == "sproutReports" %}
    
      {{ block.sproutReports}}
    
  {% endif %}
{% endfor %}

> **Comments:**
> **username_0**: My question was specific to Sprout Reports plugin.  

---

