<p><code>first()</code> and <code>limit()</code> are methods of the <code>ElementCriteriaModel</code>. Since a table is not an element, but just a plain array, you should use array filters.</p>

<p>So use Twig's <a href="http://twig.sensiolabs.org/doc/filters/slice.html" rel="nofollow"><code>slice</code></a> filter instead.</p>

<pre><code>&lt;li&gt;
    {% if companyDetails.telephoneNumbers | length %}
        {% for row in companyDetails.telephoneNumbers | slice(0, 1) %}
        &lt;a href="#contact-us" role="menuitem" aria-selected="false"&gt;{{ row.number }}&lt;/a&gt;
        {% endfor %}
    {% endif %}
    &lt;span&gt;Call us&lt;/a&gt;&lt;/span&gt;
&lt;/li&gt;
</code></pre>

CC BY-SA 3.0
2015-06-23T13:02:27.293Z
Thanks Bob, this worked great. I saw the slice else where but misunderstood its purpose.
Pathfinder
CC BY-SA 3.0
2015-06-23T10:42:46.573Z
2015-06-23T10:42:46.573Z
Bob Olde Hampsink
<p>Morning Craft folks, I've had a look and play but can't seem to find an answer for this.</p>

<p>I have a global variable with a company's various phone numbers in, stored in a table field.</p>

<p>The table shows the city, then the phone number for the company's numbers.</p>

<p>For the navigation, I want to show just the first phone number in the table.</p>

<p><code>.first()</code> and <code>.limit(1)</code> don't seem to work in this situation.</p>

<pre><code>&lt;li&gt;
    {% if companyDetails.telephoneNumbers | length %}
        {% for row in companyDetails.telephoneNumbers %}
            &lt;a href="#contact-us" role="menuitem" aria-selected="false"&gt;{{ row.number }}&lt;/a&gt;
        {% endfor %}
    {% endif %}

    &lt;span&gt;Call us&lt;/a&gt;&lt;/span&gt;
&lt;/li&gt;
</code></pre>

<p>Many thanks in advance.</p>

<globals><table-field>
Show just the first row of a table (stored in globals)
# Show just the first row of a table (stored in globals)

(Asked by: username_0 on 2015-06-23)

Morning Craft folks, I've had a look and play but can't seem to find an answer for this.
I have a global variable with a company's various phone numbers in, stored in a table field.
The table shows the city, then the phone number for the company's numbers.
For the navigation, I want to show just the first phone number in the table.
.first() and .limit(1) don't seem to work in this situation.

    {% if companyDetails.telephoneNumbers | length %}
        {% for row in companyDetails.telephoneNumbers %}
            {{ row.number }}
        {% endfor %}
    {% endif %}

    Call us


Many thanks in advance.

**Tags:** globals, table-field

---

## 1 answers

### Answer by username_1 on 2015-06-23. Score: 3 | Accepted answer

first() and limit() are methods of the ElementCriteriaModel. Since a table is not an element, but just a plain array, you should use array filters.
So use Twig's slice filter instead.

    {% if companyDetails.telephoneNumbers | length %}
        {% for row in companyDetails.telephoneNumbers | slice(0, 1) %}
        {{ row.number }}
        {% endfor %}
    {% endif %}
    Call us

> **Comments:**
> **username_0**: Thanks Bob, this worked great. I saw the slice else where but misunderstood its purpose.  

---

