<p>First, make sure you have <a href="https://craftcms.com/docs/config-settings#devMode" rel="nofollow noreferrer">devMode</a> enabled so any errors will be show. Then, I would consider writing the template code in a way that will ensure something will output when looping through the block types to help troubleshoot.</p>

<p>For example</p>

<pre><code>{# Loop through each block #}
{% for block in entry.comparisonChart %}
    {# Output templating based on the block type #}
    {% switch block.type %}
        {% case "compareChartHeadingBlock" %}
            &lt;h3&gt;{{ block.compareChartHeading }}&lt;/h3&gt;  

        {% case "compareChartTwoBlock" %}
            {% for row in block.compareChartTwo %}  
                &lt;div class="row"&gt;
                  &lt;div class="box1-3 {{ row.empty }}"&gt;{{ row.chartTwoLeft }}&lt;/div&gt;
                  &lt;div class="{{ row.chartTwoAgree }} {{ row.chartTwoDisagree }} {{ row.chartTwoSeparate }}"&gt;&lt;/div&gt;
                  &lt;div class="box1-3 {{ row.empty }}"&gt;{{ row.chartTwoRight }}&lt;/div&gt;
                &lt;/div&gt;
            {% else %}
                Compare chart two has no content
            {% endfor %}

        {% case 'compareChartThreeBlock' %}
            {% for row in block.compareChartThree %}  
                &lt;div class="row"&gt;
                    &lt;div class="box1-5 {{ row.empty }}"&gt;
                        {{ row.chart3Left }}
                    &lt;/div&gt;
                    &lt;div class="{{ row.chart3LeftAgree }} {{ row.chart3LeftDisagree }} {{ row.chart3LeftSeparate }}"&gt;&lt;/div&gt;
                    &lt;div class="box1-5 {{ row.empty }}"&gt;{{ row.chart3Center }}&lt;/div&gt;
                    &lt;div class="{{ row.chart3RightAgree }} {{ row.chart3RightDisagree }} {{ row.chart3RightSeparate }}"&gt;&lt;/div&gt;
                    &lt;div class="box1-5 {{ row.empty }}"&gt;{{ row.chart3Right }}l&lt;/div&gt;
                &lt;/div&gt;
            {% else %}
                Compare chart three has no content
            {% endfor %}

        {% default %}
            {# The message below will be displayed if the type doesn’t match those handled above #}
            This {{ block.type }}’s templating has not been handled

    {% endswitch %}

{# If the Matrix has no blocks, output a message #}
{% else %}
    This Matrix has no content
{% endfor %}
</code></pre>

<p>An approach like the above should help narrow where the problem is occuring. If you do get error messages, please post them as it can help identify where the problem is occuring as well.</p>

CC BY-SA 3.0
2018-03-26T13:42:07.070Z
Thank you Stephen! That helped out so much  :) I was able to diagnose what was happening (mismatched labeling of matrix blocks). Appreciate the help! Working great now
Jayna
CC BY-SA 3.0
2018-03-22T18:29:29.680Z
2018-03-22T18:29:29.680Z
Stephen Bowling
<p>I have a matrix table field that I want to render on a page. I've tried a few different things and nothing is working. I tried switch and elseif, but those weren't working. I'm no longer getting errors, but now - even though I have content in the fields - nothing shows up on the page. </p>

<p>It seems like it must be a templating error but I can't see what it could be. Any help would be greatly appreciated. </p>

<pre><code>{% for block in entry.comparisonChart %} 
{% if block.type == 'compareChartHeadingBlock' %}
  &lt;h3&gt;{{ block.compareChartHeading }}&lt;/h3&gt;  
{% endif %}

{% if block.type == 'compareChartTwoBlock' %}
    {% for row in block.compareChartTwo %}  
    &lt;div class="row"&gt;
      &lt;div class="box1-3 {{ row.empty }}"&gt;{{ row.chartTwoLeft }}&lt;/div&gt;
      &lt;div class="{{ row.chartTwoAgree }} {{ row.chartTwoDisagree }} {{ row.chartTwoSeparate }}"&gt;&lt;/div&gt;
      &lt;div class="box1-3 {{ row.empty }}"&gt;{{ row.chartTwoRight }}&lt;/div&gt;
    &lt;/div&gt;
     {% endfor %}
  {% endif %}


  {% if block.type == 'compareChartThreeBlock' %}
    {% for row in block.compareChartThree %}  
    &lt;div class="row"&gt;
      &lt;div class="box1-5 {{ row.empty }}"&gt;{{ row.chart3Left }}&lt;/div&gt;
      &lt;div class="{{ row.chart3LeftAgree }} {{ row.chart3LeftDisagree }} {{ row.chart3LeftSeparate }}"&gt;&lt;/div&gt;
      &lt;div class="box1-5 {{ row.empty }}"&gt;{{ row.chart3Center }}&lt;/div&gt;
      &lt;div class="{{ row.chart3RightAgree }} {{ row.chart3RightDisagree }} {{ row.chart3RightSeparate }}"&gt;&lt;/div&gt;
      &lt;div class="box1-5 {{ row.empty }}"&gt;{{ row.chart3Right }}l&lt;/div&gt;
    &lt;/div&gt;
   {% endfor %}
  {% endif %}     
  {% endfor %}
</code></pre>

<p>Here is the matrix field:</p>

<p><a href="https://i.sstatic.net/L3flP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L3flP.png" alt="enter image description here"></a></p>

<templating><matrix><field>
Matrix Table Content not showing
# Matrix Table Content not showing

(Asked by: username_0 on 2018-03-22)

I have a matrix table field that I want to render on a page. I've tried a few different things and nothing is working. I tried switch and elseif, but those weren't working. I'm no longer getting errors, but now - even though I have content in the fields - nothing shows up on the page. 
It seems like it must be a templating error but I can't see what it could be. Any help would be greatly appreciated. 
{% for block in entry.comparisonChart %} 
{% if block.type == 'compareChartHeadingBlock' %}
  {{ block.compareChartHeading }}  
{% endif %}

{% if block.type == 'compareChartTwoBlock' %}
    {% for row in block.compareChartTwo %}  
    
      {{ row.chartTwoLeft }}
      
      {{ row.chartTwoRight }}
    
     {% endfor %}
  {% endif %}


  {% if block.type == 'compareChartThreeBlock' %}
    {% for row in block.compareChartThree %}  
    
      {{ row.chart3Left }}
      
      {{ row.chart3Center }}
      
      {{ row.chart3Right }}l
    
   {% endfor %}
  {% endif %}     
  {% endfor %}

Here is the matrix field:

**Tags:** templating, matrix, field


---

## 1 answers

### Answer by username_1 on 2018-03-22. Score: 1 | Accepted answer

First, make sure you have devMode enabled so any errors will be show. Then, I would consider writing the template code in a way that will ensure something will output when looping through the block types to help troubleshoot.
For example
{# Loop through each block #}
{% for block in entry.comparisonChart %}
    {# Output templating based on the block type #}
    {% switch block.type %}
        {% case "compareChartHeadingBlock" %}
            {{ block.compareChartHeading }}  

        {% case "compareChartTwoBlock" %}
            {% for row in block.compareChartTwo %}  
                
                  {{ row.chartTwoLeft }}
                  
                  {{ row.chartTwoRight }}
                
            {% else %}
                Compare chart two has no content
            {% endfor %}

        {% case 'compareChartThreeBlock' %}
            {% for row in block.compareChartThree %}  
                
                    
                        {{ row.chart3Left }}
                    
                    
                    {{ row.chart3Center }}
                    
                    {{ row.chart3Right }}l
                
            {% else %}
                Compare chart three has no content
            {% endfor %}

        {% default %}
            {# The message below will be displayed if the type doesn’t match those handled above #}
            This {{ block.type }}’s templating has not been handled

    {% endswitch %}

{# If the Matrix has no blocks, output a message #}
{% else %}
    This Matrix has no content
{% endfor %}

An approach like the above should help narrow where the problem is occuring. If you do get error messages, please post them as it can help identify where the problem is occuring as well.

> **Comments:**
> **username_0**: Thank you Stephen! That helped out so much  :) I was able to diagnose what was happening (mismatched labeling of matrix blocks). Appreciate the help! Working great now  

---

