Answers.Body: <p>Well done for working out how to display "reverse-related" entries!</p>
  
  <p>In order to separate your Articles into two lists i.e.</p>
  
  <ol>
  <li>Articles with downloads</li>
  <li>Articles without downloads</li>
  </ol>
  
  <p>... I would do something like the following on your Company single-entry template...</p>
  
  <pre><code>{% set relatedArticles = craft.entries.section('article').relatedTo() %}
  
  {# Related articles which have downloads #}
  {% for articleEntry in relatedArticles %}
  
      {# check for Matrix content #}
      {% if articleEntry.downloads != '' %}
          &lt;h3&gt;{{ articleEntry.title }}&lt;/h3&gt;
  
          &lt;ul&gt;
              {# loop through any matrix items #}
              {% for block in articleEntry.downloads %}
  
                  {# get the first asset into a variable named 'download' #}
                  {% set download = block.downloadFile.first() %}
  
                  &lt;li&gt;&lt;a href="{{ siteUrl }}{{ download.url }}"&gt;{{ block.downloadName }}&lt;/a&gt;&lt;/li&gt;
              {% endfor %}
          &lt;/ul&gt;
  
      {% endif %}
  {% endfor %}
  
  {# Articles which do not have downloads #}
  {% for articleEntry in allArticles %}
  
      {# check for blank Matrix content #}
      {% if articleEntry.downloads == '' %}
  
          {# display article titles #}
          &lt;h3&gt;{{ articleEntry.title }}&lt;/h3&gt;
  
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Hope that helps. Let us know how you get on...</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-28T14:18:08.050Z
Answers.Text: Thank you. I am going to write up this code and see if I get the desired results. I will definitely update you and mark this as an answer once I get this working.
Answers.UserDisplayName: Subrato M
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-28T13:22:07.897Z
Answers.LastActivityDate: 2016-06-28T13:22:07.897Z
Answers.UserDisplayName: Matt P
Body: <p>I have a channel which is basically a list of articles. Each article is associated with one or more companies. When I click on companies I want to show all  the articles related to the company. I got that working, but now I want to show all the articles which have download types inside of them. So I had created a Matrix field type. I want to search for articles which will return all the articles which have those and then exclude them from other list which won't have any download association. </p>
  
  <p>Is this doable?</p>
  
Tags: <matrix><categories><channels>
Title: How to get data from Matrix field type?
ThreadText: # How to get data from Matrix field type?
  
  (Asked by: username_0 on 2016-06-17)
  
  I have a channel which is basically a list of articles. Each article is associated with one or more companies. When I click on companies I want to show all the articles related to the company. I got that working, but now I want to show all the articles which have download types inside of them. So I had created a Matrix field type. I want to search for articles which will return all the articles which have those and then exclude them from other list which won't have any download association.
  
  Is this doable?
  
  **Tags:** matrix, categories, channels
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-28. Score: 1
  
  Well done for working out how to display "reverse-related" entries!
  
  In order to separate your Articles into two lists i.e.
  
  1. Articles with downloads
  2. Articles without downloads
  
  ... I would do something like the following on your Company single-entry template...
  
  ```
  {% set relatedArticles = craft.entries.section('article').relatedTo() %}
  
  {# Related articles which have downloads #}
  {% for articleEntry in relatedArticles %}
  
      {# check for Matrix content #}
      {% if articleEntry.downloads != '' %}
          <h3>{{ articleEntry.title }}</h3>
  
          <ul>
              {# loop through any matrix items #}
              {% for block in articleEntry.downloads %}
  
                  {# get the first asset into a variable named 'download' #}
                  {% set download = block.downloadFile.first() %}
  
                  <li><a href="{{ siteUrl }}{{ download.url }}">{{ block.downloadName }}</a></li>
              {% endfor %}
          </ul>
  
      {% endif %}
  {% endfor %}
  
  {# Articles which do not have downloads #}
  {% for articleEntry in allArticles %}
  
      {# check for blank Matrix content #}
      {% if articleEntry.downloads == '' %}
  
          {# display article titles #}
          <h3>{{ articleEntry.title }}</h3>
  
      {% endif %}
  {% endfor %}
  
  ```
  
  Hope that helps. Let us know how you get on...
  
  > **Comments:**
  > **username_0**: Thank you. I am going to write up this code and see if I get the desired results. I will definitely update you and mark this as an answer once I get this working.  
  
  ---
  
  