Answers.Body: <p>Can't something like this help you?</p>
  
  <pre><code>{% for block in entry.myMatrixField.type('fruits').ligthswitchField(params) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T14:56:20.157Z
Answers.Text: Lightswitch field is a matrix block in matrix field `fruits`.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T14:59:10.943Z
Answers.Text: Sorry, not understanding the question properly :)
Answers.UserDisplayName: Oli
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-04T19:47:31.273Z
Answers.Text: You basically got my point at the first time. Didn't see that, after browsing through all my questions.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-12T14:46:48.173Z
Answers.LastActivityDate: 2015-11-12T14:46:48.173Z
Answers.UserDisplayName: Oli
Answers.Body: <p>I think, I've cracked it. I haven't tough of concatenating matrix block within the loop and set parameters right in the source.</p>
  
  <pre><code>{% for block in entry.productSettings.type('finish').inStock('1').limit(1) %}
      {{ block.amazonUri }}
  {% endfor %}
  </code></pre>
  
  <p>It gives first true element in the loop.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-14T15:41:34.447Z
Answers.LastActivityDate: 2015-11-14T15:41:34.447Z
Answers.UserDisplayName: Dominik Krulak
Body: <p>I've run into situation, where I have to loop only once, if condition has met the requirements. The condition is controlled by matrix block field <code>ligthswitch</code> which is the field in <code>finish</code>.</p>
  
  <p>Matrix structure:
  <a href="https://i.sstatic.net/vC6JD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vC6JD.png" alt="enter image description here"></a></p>
  
  <p>Actually, I've ended up doing this:</p>
  
  <pre><code>{% for block in entry.productSettings.type('finish') %}
     {% if block.inStock %}
        {{ block.amazonUri }}
     {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>which outputs cluster of characters: <code>123456</code>.
  Bear in mind, that total count of characters is count of loops. Desire output is <code>1</code>.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-12T15:12:02.630Z
Comments.Text: Could you provide a little more information on how your matrix is structured? A screenshot would be useful!
Comments.UserDisplayName: kcolls
Tags: <matrix>
Title: Output first matching matrix block model if condition is true
ThreadText: # Output first matching matrix block model if condition is true
  
  (Asked by: username_0 on 2015-11-12)
  
  I've run into situation, where I have to loop only once, if condition has met the requirements. The condition is controlled by matrix block field `ligthswitch` which is the field in `finish`.
  
  Matrix structure:
  [![enter image description here](https://i.sstatic.net/vC6JD.png)](https://i.sstatic.net/vC6JD.png)
  
  Actually, I've ended up doing this:
  
  ```
  {% for block in entry.productSettings.type('finish') %}
     {% if block.inStock %}
        {{ block.amazonUri }}
     {% endif %}
  {% endfor %}
  
  ```
  
  which outputs cluster of characters: `123456`.
  Bear in mind, that total count of characters is count of loops. Desire output is `1`.
  
  **Tags:** matrix
  
  > **Comments:**
  > **username_1**: Could you provide a little more information on how your matrix is structured? A screenshot would be useful!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-11-12. Score: 3 | Accepted answer
  
  Can't something like this help you?
  
  ```
  {% for block in entry.myMatrixField.type('fruits').ligthswitchField(params) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Lightswitch field is a matrix block in matrix field `fruits`.  
  > **username_2**: Sorry, not understanding the question properly :)  
  > **username_0**: You basically got my point at the first time. Didn't see that, after browsing through all my questions.  
  
  ---
  
  ### Answer by username_0 on 2015-11-14. Score: 0
  
  I think, I've cracked it. I haven't tough of concatenating matrix block within the loop and set parameters right in the source.
  
  ```
  {% for block in entry.productSettings.type('finish').inStock('1').limit(1) %}
      {{ block.amazonUri }}
  {% endfor %}
  
  ```
  
  It gives first true element in the loop.
  
  
  ---
  
  