Answers.Body: <p>You would loop through the Matrix field within each <code>tab</code> the same way you’d do it for any other element.</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set tabs = entry.descendants %}
  {% for tab in tabs %}
      {{ tab.title }}
      {% for block in tab.myMatrixFieldHandle %}
          {% if block.type == 'about' %}
              ...
          {% elseif block.type == 'team' %}
              ...
          {% elseif block.type == 'clients' %}
              ...
          {% endif %}
      {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-26T04:03:56.617Z
Answers.Text: Thanks - my problem was in naming as my matrixFieldHandle was actually called 'tab' - bit of a Herp Derp moment!
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-20T23:55:40.823Z
Answers.LastActivityDate: 2014-10-20T23:55:40.823Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I have a structure with 1 main Entry and 3 descendants underneath it but I have trouble accessing the data in matrix fields in the entries. I'm trying to do this all on one page:</p>
  
  <pre><code>{% set tabs = entry.descendants %}
       {% for tab in tabs %}
            {{ tab.title }}
       {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>I can get as far as the tab title, and it displays fine. But I want to access the matrix fields in the descendants. Here are the blocks in my field with the handle 'tab'. </p>
  
  <p><img src="https://i.sstatic.net/dzkAU.png" alt="Blocks"></p>
  
  <p>So to summarise, I have a structure:</p>
  
  <p><img src="https://i.sstatic.net/03WvP.png" alt="Structure"></p>
  
  <p>and then I want to use all those descendant data all one one page but I'm having trouble accessing it.</p>
  
Tags: <matrix><structure><entrymodel>
Title: Accessing structure descendants data
ThreadText: # Accessing structure descendants data
  
  (Asked by: username_0 on 2014-10-19)
  
  I have a structure with 1 main Entry and 3 descendants underneath it but I have trouble accessing the data in matrix fields in the entries. I'm trying to do this all on one page:
  
  ```
  {% set tabs = entry.descendants %}
       {% for tab in tabs %}
            {{ tab.title }}
       {% endfor %}
  {% endfor %}
  
  ```
  
  I can get as far as the tab title, and it displays fine. But I want to access the matrix fields in the descendants. Here are the blocks in my field with the handle 'tab'.
  
  ![Blocks](https://i.sstatic.net/dzkAU.png)
  
  So to summarise, I have a structure:
  
  ![Structure](https://i.sstatic.net/03WvP.png)
  
  and then I want to use all those descendant data all one one page but I'm having trouble accessing it.
  
  **Tags:** matrix, structure, entrymodel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-20. Score: 2 | Accepted answer
  
  You would loop through the Matrix field within each `tab` the same way you’d do it for any other element.
  
  ```twig
  {% set tabs = entry.descendants %}
  {% for tab in tabs %}
      {{ tab.title }}
      {% for block in tab.myMatrixFieldHandle %}
          {% if block.type == 'about' %}
              ...
          {% elseif block.type == 'team' %}
              ...
          {% elseif block.type == 'clients' %}
              ...
          {% endif %}
      {% endfor %}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks - my problem was in naming as my matrixFieldHandle was actually called 'tab' - bit of a Herp Derp moment!  
  
  ---
  
  