<p>You should be able to do this by adding an additional <a href="https://github.com/aelvan/Preparse-Field-Craft" rel="nofollow noreferrer">Preparse</a> field to the entry.</p>

<p>Set the value of the field (call it <code>quoteLength</code>) to this:</p>

<pre><code>{{ entry.quote | length }}
</code></pre>

<p>Then search for all entries with a quote less than 200 characters using this search:</p>

<pre><code>{% set params = {
    limit: 3, order: 'RAND()', quoteLength: '&lt; 200', section: 'quotes'
} %}
</code></pre>

CC BY-SA 3.0
2017-03-03T12:52:56.323Z
Thanks Steve. That's a decent option but I think since these particular entries are old (from an import) and new ones will be shorter, I'll just discard the old ones based on date or entry.type.
Ian Ebden
CC BY-SA 3.0
2017-03-03T12:39:16.520Z
2017-03-03T12:39:16.520Z
Steve Rowling
<p>I'm not 100% sure what you are trying to achieve but If its because all the others would be to big for whatever you're building. You could use Hacksaw to fit all your text.</p>

<p><a href="https://github.com/ryanshrum/hacksaw" rel="nofollow noreferrer">https://github.com/ryanshrum/hacksaw</a></p>

CC BY-SA 3.0
2017-03-03T11:34:31.353Z
Yeah that's the problem I have. Some entries are too long for this particular use. Don't really want to truncate. Thanks though.
Ian Ebden
CC BY-SA 3.0
2017-03-03T11:31:03.643Z
2017-03-03T11:31:03.643Z
Justin Dekkers
<p>So I'm not sure this is possible with the entries search param but I'm trying to return entries where a field (rich text) has fewer than 200 characters. This is obviously horribly wrong but something like...</p>

<pre><code>{% set params = {
    limit: 3, order: 'RAND()', search: 'quote:|length &lt; 200', section: 'quotes'
} %}
</code></pre>

<p>Any help much appreciated!</p>

<entries><search>
Search/return entries with custom field length less than 200
# Search/return entries with custom field length less than 200

(Asked by: username_0 on 2017-03-03)

So I'm not sure this is possible with the entries search param but I'm trying to return entries where a field (rich text) has fewer than 200 characters. This is obviously horribly wrong but something like...
{% set params = {
    limit: 3, order: 'RAND()', search: 'quote:|length < 200', section: 'quotes'
} %}

Any help much appreciated!

**Tags:** entries, search


---

## 2 answers

### Answer by username_1 on 2017-03-03. Score: 1 | Accepted answer

You should be able to do this by adding an additional Preparse field to the entry.
Set the value of the field (call it quoteLength) to this:
{{ entry.quote | length }}

Then search for all entries with a quote less than 200 characters using this search:
{% set params = {
    limit: 3, order: 'RAND()', quoteLength: '< 200', section: 'quotes'
} %}

> **Comments:**
> **username_0**: Thanks Steve. That's a decent option but I think since these particular entries are old (from an import) and new ones will be shorter, I'll just discard the old ones based on date or entry.type.  

---

### Answer by username_2 on 2017-03-03. Score: 1

I'm not 100% sure what you are trying to achieve but If its because all the others would be to big for whatever you're building. You could use Hacksaw to fit all your text.

<https://github.com/ryanshrum/hacksaw>

> **Comments:**
> **username_0**: Yeah that's the problem I have. Some entries are too long for this particular use. Don't really want to truncate. Thanks though.  

---

