Only display entries based on a field conditional Hey I am trying to get 4 entries, but only want 4 that have a body length > 100. 

How would I accomplish this?

{% for entry in craft.entries.section('artists').order('RAND()').limit(4) %}
  // only display 4 entries with entry.body|length &gt; 100
{% endfor %}


Thanks!
You could do something like this:

{# Grab all entries with a body &gt; 100 %}
{% for entry in craft.entries.section('artists').order('RAND()').find() if entry.body|length &gt; 100 %}

{# Limit output to the first 4 #}
{% if loop.index1 &lt;= 4 %}
        {{ entry.id }}'s body field has a length greater than 100!&lt;br /&gt;
    {% endif %}
{% endfor %}


Keep in mind that if entry.body is a Rich Text field than any HTML markup (&lt;p&gt;, &lt;span&gt;, etc.) will be included in that length count as well.

Twig doesn't have a break or continue tag natively, but if you install the MN Break and Continue plugin, you can make it a bit more efficient:

{# Grab all entries with a body &gt; 100 %}
{% for entry in craft.entries.section('artists').order('RAND()').find() if entry.body|length &gt; 100 %}
    {% if loop.index1 &gt; 4 %}
        {% break %}
    {% endif %}

    {{ entry.id }}'s body field has a length greater than 100!&lt;br /&gt;
{% endfor %}