<p>Seems to be working after upgrading to 3.0.0-beta.21. Thanks @Ben!</p>

CC BY-SA 4.0
2018-07-28T14:58:38.340Z
2018-07-28T14:58:38.340Z
Amanda Lutz
<p><em>First, As this question is about a beta version of Sprout Forms I'd recommend updating to the latest version as we are actively fixing several minor issues as we work toward a stable release.</em></p>

<p>More generally, Form Entries support searching for a value via a custom field, however, I think the issue you may be running into relates to Related Entries vs Custom Fields that store their data in the content columns. </p>

<p>You can use syntax like you've shared to query a custom text field:</p>

<pre><code>{% set entries = craft.sproutForms.entries
  .formHandle('myForm')
  .customField("hello") %}
</code></pre>

<p>For relations fields, using the <code>relatedTo</code> parameter performs a search for relationships:</p>

<pre><code>{% set entries = craft.sproutForms.entries
  .formHandle('myForm')
  .relatedTo(4) %}
</code></pre>

CC BY-SA 4.0
2018-07-18T15:36:31.500Z
Using .relatedTo will be useful in future ‘has this report been assigned yet’ queries but right now the form’s company field is hidden with value = company’s id. Will look into moving from beta to stable release, thanks.
Amanda Lutz
CC BY-SA 4.0
2018-07-18T16:01:20.613Z
FYI (and to overstep my boundaries): if you move clause (ie `'reportHazardDeficiency'.'field_company'='4'`) out of subquery where and to outer where it would work.
Amanda Lutz
CC BY-SA 4.0
2018-07-18T22:26:17.287Z
I see, so it's not a related value it's just a text value. We can review what we're doing in that query and see if we can adjust that clause. We definitely want to support the search syntax you're going for with text values. I'll update this thread after we've had a chance to review.
Ben Parizek
CC BY-SA 4.0
2018-07-17T13:49:13.673Z
2018-07-17T13:49:13.673Z
Ben Parizek
<p>Based on <a href="https://craftcms.stackexchange.com/questions/13089/filter-sprout-forms-entries-based-on-field-value-using-parameters">this very helpful question</a> I'm trying to filter the display of Sprout Form entries based on the value of a form field.</p>

<p>For example, my form handle is 'reportHazardDeficiency' and my field name is 'company'. My template has <code>craft.sproutForms.entries.formHandle( 'reportHazardDeficiency' ).company( 4 )</code> and I get </p>

<p>Database Exception – yii\db\Exception Unknown column 'reportHazardDeficiency.field_company' in 'where clause'</p>

<p>I'm running craft3 and Sprout Form trial version 3.0.0-beta.16.</p>

CC BY-SA 4.0
2018-07-12T00:01:36.990Z
This is a bug. We'll be fixing this soon in an upcoming release.
Ben Parizek
<craft3><filter><plugin-sproutforms>
Filter Sprout Form entries throwing error
# Filter Sprout Form entries throwing error

(Asked by: username_0 on 2018-06-11)

Based on [this very helpful question](https://craftcms.stackexchange.com/questions/13089/filter-sprout-forms-entries-based-on-field-value-using-parameters) I'm trying to filter the display of Sprout Form entries based on the value of a form field.

For example, my form handle is 'reportHazardDeficiency' and my field name is 'company'. My template has `craft.sproutForms.entries.formHandle( 'reportHazardDeficiency' ).company( 4 )` and I get

Database Exception – yii\db\Exception Unknown column 'reportHazardDeficiency.field\_company' in 'where clause'

I'm running craft3 and Sprout Form trial version 3.0.0-beta.16.

**Tags:** craft3, filter, plugin-sproutforms
> **Comments:**
> **username_1**: This is a bug. We'll be fixing this soon in an upcoming release.  

---

## 2 answers

### Answer by username_0 on 2018-07-28. Score: 1 | Accepted answer

Seems to be working after upgrading to 3.0.0-beta.21. Thanks @Ben!


---

### Answer by username_1 on 2018-07-17. Score: 0

First, As this question is about a beta version of Sprout Forms I'd recommend updating to the latest version as we are actively fixing several minor issues as we work toward a stable release.
More generally, Form Entries support searching for a value via a custom field, however, I think the issue you may be running into relates to Related Entries vs Custom Fields that store their data in the content columns. 
You can use syntax like you've shared to query a custom text field:
{% set entries = craft.sproutForms.entries
  .formHandle('myForm')
  .customField("hello") %}

For relations fields, using the relatedTo parameter performs a search for relationships:
{% set entries = craft.sproutForms.entries
  .formHandle('myForm')
  .relatedTo(4) %}

> **Comments:**
> **username_0**: Using .relatedTo will be useful in future ‘has this report been assigned yet’ queries but right now the form’s company field is hidden with value = company’s id. Will look into moving from beta to stable release, thanks.  
> **username_0**: FYI (and to overstep my boundaries): if you move clause (ie `'reportHazardDeficiency'.'field_company'='4'`) out of subquery where and to outer where it would work.  
> **username_1**: I see, so it's not a related value it's just a text value. We can review what we're doing in that query and see if we can adjust that clause. We definitely want to support the search syntax you're going for with text values. I'll update this thread after we've had a chance to review.  

---

