Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-23T13:02:27.293Z
Answers.Text: Thanks Bob, this worked great. I saw the slice else where but misunderstood its purpose.
Answers.UserDisplayName: Pathfinder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-23T10:42:46.573Z
Answers.LastActivityDate: 2015-06-23T10:42:46.573Z
Answers.UserDisplayName: Bob Olde Hampsink
Body: <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>
  
Tags: <globals><table-field>
Title: Show just the first row of a table (stored in globals)
ThreadText: # 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.
  
  ```
  <li>
      {% if companyDetails.telephoneNumbers | length %}
          {% for row in companyDetails.telephoneNumbers %}
              <a href="#contact-us" role="menuitem" aria-selected="false">{{ row.number }}</a>
          {% endfor %}
      {% endif %}
  
      <span>Call us</a></span>
  </li>
  
  ```
  
  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`](http://twig.sensiolabs.org/doc/filters/slice.html) filter instead.
  
  ```
  <li>
      {% if companyDetails.telephoneNumbers | length %}
          {% for row in companyDetails.telephoneNumbers | slice(0, 1) %}
          <a href="#contact-us" role="menuitem" aria-selected="false">{{ row.number }}</a>
          {% endfor %}
      {% endif %}
      <span>Call us</a></span>
  </li>
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks Bob, this worked great. I saw the slice else where but misunderstood its purpose.  
  
  ---
  
  