Answers.Body: <p>Here is the workaround I've resorted to using in the meantime.</p>
  
  <pre><code>{# Initiate the hash in which we'll store matching submissions. #}
  {% set matchingSubmissions = [] %}
  
  {#
      Loop through all submissions, checking if the specified field
      matches the desired value.
  #}
  {% for submission in submissions if submission.fieldWithValue == '123' %}
  
      {# If the field matches, add it to the hash #}
      {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}
  
  {% endfor %}
  
  {# Count the size of the resulting hash and save it. #}
  {% set submissionCount = matchingSubmissions|length %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-25T10:45:59.727Z
Answers.LastActivityDate: 2018-01-25T10:45:59.727Z
Answers.UserDisplayName: Sandwich
Answers.Body: <p>Unfortunately this currently isn't possible. However, we've added it to the feature requests list and will revisit adding this in the not-too-distant future. :)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T19:33:30.973Z
Answers.Text: Drat! I'm converting an EE site that uses that Freeform feature and had expected to be able to do the same things. :-/
Answers.UserDisplayName: Sandwich
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T21:28:05.613Z
Answers.Text: @solspace I'm just curious... It took me only a few minutes to create that feature with a custom function and a search via Yii Records, why don't you present a workaround even just for this special use case - instead of saying not possible currently?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-24T11:53:45.810Z
Answers.Text: I'd love to see a temporary workaround for this...?
Answers.UserDisplayName: Sandwich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-10T12:21:45.787Z
Answers.Text: Is this possible right now? @Solspace
Answers.UserDisplayName: Maarten Heideman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-13T03:36:31.430Z
Answers.Text: An upcoming version will include this (late May 2019)
Answers.UserDisplayName: Solspace
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T17:37:10.537Z
Answers.LastActivityDate: 2017-12-21T17:37:10.537Z
Answers.UserDisplayName: Solspace
Answers.Body: <p>This might not work, but you can try it like so:</p>
  
  <pre><code>{% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm',
      fieldWithValue: '123',
  }).count() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T17:36:26.733Z
Answers.LastActivityDate: 2017-12-21T17:36:26.733Z
Answers.UserDisplayName: carlcs
Body: <p>I need to be able to get a count (in the frontend) of the number of submissions that have a field with a specific value. I don't need the submitted data of the submissions, just the count of submissions whose data matches a specified value.</p>
  
  <p>This code returns the total number of submissions:</p>
  
  <pre><code>{% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm'
  }).count %}
  </code></pre>
  
  <p>I tried using the native Craft search parameter, but it returns zero:</p>
  
  <pre><code>{% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm'
  }).search('fieldWithValue:123').count %}
  </code></pre>
  
  <p>And yes, there <em>are</em> submissions that would match that.</p>
  
  <p>How can I do this?</p>
  
Tags: <search><plugin-freeform><freeform>
Title: Search/Filter Freeform submissions by field value
ThreadText: # Search/Filter Freeform submissions by field value
  
  (Asked by: username_0 on 2017-12-21)
  
  I need to be able to get a count (in the frontend) of the number of submissions that have a field with a specific value. I don't need the submitted data of the submissions, just the count of submissions whose data matches a specified value.
  
  This code returns the total number of submissions:
  
  ```
  {% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm'
  }).count %}
  
  ```
  
  I tried using the native Craft search parameter, but it returns zero:
  
  ```
  {% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm'
  }).search('fieldWithValue:123').count %}
  
  ```
  
  And yes, there *are* submissions that would match that.
  
  How can I do this?
  
  **Tags:** search, plugin-freeform, freeform
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2018-01-25. Score: 1 | Accepted answer
  
  Here is the workaround I've resorted to using in the meantime.
  
  ```
  {# Initiate the hash in which we'll store matching submissions. #}
  {% set matchingSubmissions = [] %}
  
  {#
      Loop through all submissions, checking if the specified field
      matches the desired value.
  #}
  {% for submission in submissions if submission.fieldWithValue == '123' %}
  
      {# If the field matches, add it to the hash #}
      {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}
  
  {% endfor %}
  
  {# Count the size of the resulting hash and save it. #}
  {% set submissionCount = matchingSubmissions|length %}
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2017-12-21. Score: 1
  
  Unfortunately this currently isn't possible. However, we've added it to the feature requests list and will revisit adding this in the not-too-distant future. :)
  
  > **Comments:**
  > **username_0**: Drat! I'm converting an EE site that uses that Freeform feature and had expected to be able to do the same things. :-/  
  > **username_2**: @username_1 I'm just curious... It took me only a few minutes to create that feature with a custom function and a search via Yii Records, why don't you present a workaround even just for this special use case - instead of saying not possible currently?  
  > **username_0**: I'd love to see a temporary workaround for this...?  
  > **username_3**: Is this possible right now? @username_1  
  > **username_1**: An upcoming version will include this (late May 2019)  
  
  ---
  
  ### Answer by username_4 on 2017-12-21. Score: 1
  
  This might not work, but you can try it like so:
  
  ```
  {% set submissionCount = craft.freeform.submissions({
      form: 'myAmazingForm',
      fieldWithValue: '123',
  }).count() %}
  
  ```
  
  
  ---
  
  