Answers.Body: <p>Craft adds those extra elements to each array of table cells only if there's column handles defined in your Table Field.</p>
  
  <p>This allows you to not only access a cell's value via <code>row.col1</code>, <code>row.col2</code>, etc. but also using the columns handle, e.g. <code>row.price</code>.</p>
  
  <p>If you don't want to use this feature or programatically loop the cells, <strong>don't define column handles!</strong></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-24T12:40:19.853Z
Answers.LastActivityDate: 2015-02-24T12:45:57.267Z
Answers.LastEditDate: 2015-02-24T12:45:57.267Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>I suppose in your example <code>codePoints</code> is the actual Table field.</p>
  
  <p>In order to output the table rows, the template should look like this:</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>You get a double output because every row contains an array containing each table field twice, it looks like this:</p>
  
  <pre><code>array(2) { ["col1"]=&gt; string(4) "Some" ["text"]=&gt; string(4) "Some" }
  </code></pre>
  
  <p>That's why when loop over <code>items</code> you get every text twice.</p>
  
  <p>I hope this helps.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T18:48:25.990Z
Answers.Text: Thank you Mario - that did it. How did you output that array?
Answers.UserDisplayName: Caroline from Aquarian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T19:31:29.993Z
Answers.Text: I activated devMode and in my template I used `{{ dump(row) }}`
Answers.UserDisplayName: Mario
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T18:33:44.963Z
Answers.LastActivityDate: 2016-04-14T08:20:51.180Z
Answers.LastEditDate: 2016-04-14T08:20:51.180Z
Answers.UserDisplayName: Mario
Body: <p>I have set up a <a href="http://buildwithcraft.com/docs/matrix-fields" rel="nofollow">Matrix field</a> with three blocks, each contains a <a href="http://buildwithcraft.com/docs/table-fields" rel="nofollow">Table field</a>.</p>
  
  <p>Each table has one column - a single line text field.</p>
  
  <p>When I call these tables into the template with this code, each row is echoed twice:</p>
  
  <pre class="lang-html prettyprint-override"><code>{% for block in entry.projectFacts.limit(3) %}
      &lt;div class="panel panel-default"&gt;
      {% switch block.type %}
          {% case 'code' %}
              {% if block.codePoints | length %}
                  &lt;ul&gt;
                      {% for items in block.codePoints %}
  
                          /* Outputs "Array" */
                          {{ items }}
  
                          {% for wtf in items %}
                              /* Outputs identical content &amp; wrapper twice */
                              &lt;li&gt;{{ wtf }}&lt;/li&gt;
                          {% endfor %}
  
                      {% endfor %}
                  &lt;/ul&gt;
              {% endif %}
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>I'd be delighted if someone were able to point out what I need to do differently.</p>
  
Tags: <templating><forloop><table-field>
Title: How to correctly output a Table Field?
ThreadText: # How to correctly output a Table Field?
  
  (Asked by: username_0 on 2014-07-01)
  
  I have set up a [Matrix field](http://buildwithcraft.com/docs/matrix-fields) with three blocks, each contains a [Table field](http://buildwithcraft.com/docs/table-fields).
  
  Each table has one column - a single line text field.
  
  When I call these tables into the template with this code, each row is echoed twice:
  
  ```html
  {% for block in entry.projectFacts.limit(3) %}
      <div class="panel panel-default">
      {% switch block.type %}
          {% case 'code' %}
              {% if block.codePoints | length %}
                  <ul>
                      {% for items in block.codePoints %}
  
                          /* Outputs "Array" */
                          {{ items }}
  
                          {% for wtf in items %}
                              /* Outputs identical content & wrapper twice */
                              <li>{{ wtf }}</li>
                          {% endfor %}
  
                      {% endfor %}
                  </ul>
              {% endif %}
      </div>
  {% endfor %}
  
  ```
  
  I'd be delighted if someone were able to point out what I need to do differently.
  
  **Tags:** templating, forloop, table-field
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-07-01. Score: 11 | Accepted answer
  
  I suppose in your example `codePoints` is the actual Table field.
  
  In order to output the table rows, the template should look like this:
  
  ```
  {% if block.codePoints | length %}
      <ul>
      {% for row in block.codePoints %}
           {# Assuming 'text' is the column handle of the text field #}
          <li>{{ row.text }}</li> 
      {% endfor %}
      </ul>
  {% endif %}
  
  ```
  
  You get a double output because every row contains an array containing each table field twice, it looks like this:
  
  ```
  array(2) { ["col1"]=> string(4) "Some" ["text"]=> string(4) "Some" }
  
  ```
  
  That's why when loop over `items` you get every text twice.
  
  I hope this helps.
  
  > **Comments:**
  > **username_0**: Thank you username_2 - that did it. How did you output that array?  
  > **username_2**: I activated devMode and in my template I used `{{ dump(row) }}`  
  
  ---
  
  ### Answer by username_1 on 2015-02-24. Score: 6
  
  Craft adds those extra elements to each array of table cells only if there's column handles defined in your Table Field.
  
  This allows you to not only access a cell's value via `row.col1`, `row.col2`, etc. but also using the columns handle, e.g. `row.price`.
  
  If you don't want to use this feature or programatically loop the cells, **don't define column handles!**
  
  
  ---
  
  