<p>Assuming your example code, something along these lines will help...</p>

<pre><code>{% if entry.yourTable | length %}
    &lt;table&gt;
    {% for row in entry.yourTable %}
    &lt;tr&gt;
       &lt;td&gt;{{ row.column1 }}&lt;/td&gt;&lt;td&gt;{{ row.column2 }}&lt;/td&gt;&lt;td&gt;{{ row.column3 }}&lt;/td&gt;
    &lt;/tr&gt; 
    {% endfor %}
    &lt;/table&gt;
{% endif %}
</code></pre>

<p>Here's the relevant section in the docs: <a href="https://craftcms.com/docs/table-fields#templating" rel="nofollow noreferrer">Table fields</a></p>

CC BY-SA 3.0
2016-12-23T15:50:24.070Z
2016-12-23T15:50:24.070Z
Steve Holland
<p>Need a hand on a conditional to see if my table has any data, and if it does, output the table. The second thing I  need help is the code to output the table. When I look at tutorials, they always seem to output the table as an HTML list. Like:</p>

<pre><code>   {% if block.codePoints | length %}
    &lt;ul&gt;
    {% for row in block.codePoints %}
         {# Assuming 'text' is the column handle of the text field #}
        &lt;li&gt;{{ row.text }}&lt;/li&gt; 
    {% endfor %}
    &lt;/ul&gt;
{% endif %}
</code></pre>

<p>I can't find an example of:</p>

<pre><code>&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Thanks.</p>

CC BY-SA 3.0
2016-12-23T03:31:04.777Z
Is `block` a Matrix block?  If so, what type of field is `codePoints`?  Or is `block` the name of an entry and `codePoints` is a table field?
Brad Bell
CC BY-SA 3.0
2016-12-23T13:08:38.413Z
I'm unclear about the example code. It isn't my code but what I found on Stack Exchange. I just used it as an example. I can't seem to find an example to output a table using <table> mark-up. And also need to check to see if table is blank. Each table has 1 row of blank so my condition is failing.
DevServe
<entry><conditional><table>
Conditionals and outputting tables
# Conditionals and outputting tables

(Asked by: username_0 on 2016-12-23)

Need a hand on a conditional to see if my table has any data, and if it does, output the table. The second thing I  need help is the code to output the table. When I look at tutorials, they always seem to output the table as an HTML list. Like:
   {% if block.codePoints | length %}
    
    {% for row in block.codePoints %}
         {# Assuming 'text' is the column handle of the text field #}
        {{ row.text }} 
    {% endfor %}
    
{% endif %}

I can't find an example of:




Thanks.

**Tags:** entry, conditional, table

> **Comments:**
> **username_1**: Is `block` a Matrix block?  If so, what type of field is `codePoints`?  Or is `block` the name of an entry and `codePoints` is a table field?  
> **username_0**: I'm unclear about the example code. It isn't my code but what I found on Stack Exchange. I just used it as an example. I can't seem to find an example to output a table using <table> mark-up. And also need to check to see if table is blank. Each table has 1 row of blank so my condition is failing.  

---

## 1 answers

### Answer by username_2 on 2016-12-23. Score: 2 | Accepted answer

Assuming your example code, something along these lines will help...
{% if entry.yourTable | length %}
    
    {% for row in entry.yourTable %}
    
       {{ row.column1 }}{{ row.column2 }}{{ row.column3 }}
     
    {% endfor %}
    
{% endif %}

Here's the relevant section in the docs: Table fields


---

