Answers.Body: <p>If I'm understanding what you've asked correctly (and there's every chance I'm not – it's been a long day), I've got something similar on one of my sites and I'm using the following code:</p>
  
  <pre><code>{% for faq in entry.faq if faq.column == 'Left' %}
      &lt;li&gt;
          &lt;h3&gt;{{ faq.question }}&lt;/h3&gt;
          &lt;p&gt;{{ faq.answer }}&lt;/p&gt;
      &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>then:</p>
  
  <pre><code>{% for faq in entry.faq if faq.column == 'Right' %}
      &lt;li&gt;
          &lt;h3&gt;{{ faq.question }}&lt;/h3&gt;
          &lt;p&gt;{{ faq.answer }}&lt;/p&gt;
      &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>In this case 'faq' is the Matrix field and 'faq.column' is the Position Select field.</p>
  
  <p>There are neater ways to do this to avoid the repeated code, but you get the idea.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-06T20:08:57.933Z
Answers.Text: That's actually a pretty elegant solution! Not to mention didn't know you could combine the for and if statements!
Answers.UserDisplayName: crawf
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-06T18:36:41.230Z
Answers.LastActivityDate: 2014-11-06T18:36:41.230Z
Answers.UserDisplayName: Steve Abraham
Body: <p>Just working with a Matrix field to create a flexible, 2 column layout. The user can choose to add either an Image or Rich Text field, and position them accordingly with the Position Select field.</p>
  
  <p>To illustrate, one layout might be:</p>
  
  <pre><code>| image | image |
  |       |       |
  | text  | text  |
  </code></pre>
  
  <p>But another might be:</p>
  
  <pre><code>| image | text  |
  |       |       |
  | image | text  |
  </code></pre>
  
  <p>Now my solution is to first loop through the Matrix field for each possible position option and group fields depending on their position into arrays. ie: <code>leftContent[]</code>, <code>rightContent[]</code>, etc.</p>
  
  <p>Printing them out is then simple:</p>
  
  <pre><code>&lt;div class="col col-6 mobile-full"&gt;
      {% for row in leftContent %}
          {% if row.type == 'image' %}
              &lt;img src="{{ row.image.first().getUrl() }}" /&gt;
          {% else %}
              {{ row.text }}
          {% endif %}
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>It would certainly make things easier if you could grab fields for x position? I'm aware this is more of a HTML layout issue and should really be left to the template creator to figure out, but just wanted to see if people had come across this.</p>
  
  <p>Hope that makes sense :)</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-06T14:08:19.777Z
Comments.Text: possible duplicate of [How can I return specific matrix rows based on criteria?](http://craftcms.stackexchange.com/questions/2307/how-can-i-return-specific-matrix-rows-based-on-criteria)
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-06T14:14:45.200Z
Comments.Text: Hey crawf! I think it's not possible to grab only those matrix blocks with that criteria (→ see that other question). But you found a good workaround to separate them using two arrays `leftContent[]`, `rightContent[]`!
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-06T20:10:18.040Z
Comments.Text: @carlcs I did see that question, and workaround is a little overboard, but works for the moment!
Comments.UserDisplayName: crawf
Tags: <templating><matrix><filter>
Title: Get all fields within Matrix for position?
ThreadText: # Get all fields within Matrix for position?
  
  (Asked by: username_0 on 2014-11-06)
  
  Just working with a Matrix field to create a flexible, 2 column layout. The user can choose to add either an Image or Rich Text field, and position them accordingly with the Position Select field.
  
  To illustrate, one layout might be:
  
  ```
  | image | image |
  |       |       |
  | text  | text  |
  
  ```
  
  But another might be:
  
  ```
  | image | text  |
  |       |       |
  | image | text  |
  
  ```
  
  Now my solution is to first loop through the Matrix field for each possible position option and group fields depending on their position into arrays. ie: `leftContent[]`, `rightContent[]`, etc.
  
  Printing them out is then simple:
  
  ```
  <div class="col col-6 mobile-full">
      {% for row in leftContent %}
          {% if row.type == 'image' %}
              <img src="{{ row.image.first().getUrl() }}" />
          {% else %}
              {{ row.text }}
          {% endif %}
      {% endfor %}
  </div>
  
  ```
  
  It would certainly make things easier if you could grab fields for x position? I'm aware this is more of a HTML layout issue and should really be left to the template creator to figure out, but just wanted to see if people had come across this.
  
  Hope that makes sense :)
  
  **Tags:** templating, matrix, filter
  
  > **Comments:**
  > **username_1**: possible duplicate of [How can I return specific matrix rows based on criteria?](http://craftcms.stackexchange.com/questions/2307/how-can-i-return-specific-matrix-rows-based-on-criteria)  
  > **username_1**: Hey username_0! I think it's not possible to grab only those matrix blocks with that criteria (→ see that other question). But you found a good workaround to separate them using two arrays `leftContent[]`, `rightContent[]`!  
  > **username_0**: @username_1 I did see that question, and workaround is a little overboard, but works for the moment!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-11-06. Score: 2 | Accepted answer
  
  If I'm understanding what you've asked correctly (and there's every chance I'm not – it's been a long day), I've got something similar on one of my sites and I'm using the following code:
  
  ```
  {% for faq in entry.faq if faq.column == 'Left' %}
      <li>
          <h3>{{ faq.question }}</h3>
          <p>{{ faq.answer }}</p>
      </li>
  {% endfor %}
  
  ```
  
  then:
  
  ```
  {% for faq in entry.faq if faq.column == 'Right' %}
      <li>
          <h3>{{ faq.question }}</h3>
          <p>{{ faq.answer }}</p>
      </li>
  {% endfor %}
  
  ```
  
  In this case 'faq' is the Matrix field and 'faq.column' is the Position Select field.
  
  There are neater ways to do this to avoid the repeated code, but you get the idea.
  
  > **Comments:**
  > **username_0**: That's actually a pretty elegant solution! Not to mention didn't know you could combine the for and if statements!  
  
  ---
  
  