Answers.Body: <p>Turns out it needs the space in the conditional either side of the vertical bar so the code should’ve been:                 </p>
  
  <pre><code>&lt;li&gt;{% if block.destination | length &gt; 25 %}&lt;br /&gt;{% endif %} {{ block.smallCost }}&lt;/li&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-05T17:27:03.807Z
Answers.Text: Really weird... not sure why that would be the case.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-05T16:47:48.427Z
Answers.LastActivityDate: 2014-09-05T16:47:48.427Z
Answers.UserDisplayName: simonsweeney
Body: <p>Wondering how to write a conditional that was dependent on the length of a plain text field within a matrix field. I  have something like:</p>
  
  <pre><code>{% for block in entry.pricing %}
      &lt;li&gt;{% if block.destination|length &gt; 25 %}TEST{% endif %}{{ block.smallCost }}&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>Where I’m trying to add TEST if the length of the string of block.destination is more than 25. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-09-05T12:33:14.983Z
Comments.Text: That should work as far as I can tell. What happends if you try to output {{ block.destination | length }}?
Comments.UserDisplayName: André Elvan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-09-05T16:44:29.563Z
Comments.Text: It outputs totally fine, giving the length of the string. It’s just the conditional I can’t figure out?
Comments.UserDisplayName: simonsweeney
Tags: <conditional>
Title: Plain Text Length Conditional
ThreadText: # Plain Text Length Conditional
  
  (Asked by: username_0 on 2014-09-05)
  
  Wondering how to write a conditional that was dependent on the length of a plain text field within a matrix field. I have something like:
  
  ```
  {% for block in entry.pricing %}
      <li>{% if block.destination|length > 25 %}TEST{% endif %}{{ block.smallCost }}</li>
  {% endfor %}
  
  ```
  
  Where I’m trying to add TEST if the length of the string of block.destination is more than 25.
  
  **Tags:** conditional
  
  > **Comments:**
  > **username_1**: That should work as far as I can tell. What happends if you try to output {{ block.destination | length }}?  
  > **username_0**: It outputs totally fine, giving the length of the string. It’s just the conditional I can’t figure out?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2014-09-05. Score: 1
  
  Turns out it needs the space in the conditional either side of the vertical bar so the code should’ve been:
  
  ```
  <li>{% if block.destination | length > 25 %}<br />{% endif %} {{ block.smallCost }}</li>
  
  ```
  
  > **Comments:**
  > **username_2**: Really weird... not sure why that would be the case.  
  
  ---
  
  